System Configuration

This sections describes how the operating system has to be configured in order to run the DMPACK programs:

  • Time Zone – Set the correct time zone of the sensor node.

  • Time Synchronisation – Enable synchronisation with an NTP server.

  • Power Saving – Disable USB power saving on Linux.

  • Cron – Add cron jobs to run programs periodically.

Time Zone

The local time zone of the sensor client should be set to a zone without summer daylight-saving. For instance, time zone Europe/Berlin implies Central European Summer Time (CEST), which is usually not desired for long-term observations, as it leads to time jumps. Instead, use time zone GMT+1 or UTC in this case.

Linux

On Linux, list all time zones and set the preferred one with timedatectl(1):

# timedatectl list-timezones
# timedatectl set-timezone Etc/GMT+1
FreeBSD

On FreeBSD, configure the time zone using:

# tzsetup

Time Synchronisation

The system time should be updated periodically by synchronising it with network time servers. A Network Time Protocol (NTP) client has to be installed and configured to enable the synchronisation.

Linux

On Debian Linux, install the NTP package:

# apt-get install ntp

Query the NTP servers to synchronise with:

# ntpq -p

The system time should be updated now:

# date -R

On error, try to reconfigure the NTP service:

# dpkg-reconfigure ntp
FreeBSD

Set the current date and time intially by passing the IP or FQDN of the NTP server to ntpdate(1):

# ntpdate -b ptbtime1.ptb.de

The NTP daemon ntpd(8) is configured through file /etc/ntp.conf. If favoured, we can replace the existing NTP server pool 0.freebsd.pool.ntp.org with a single server, for example:

server ptbtime1.ptb.de iburst

Add the following entries to /etc/rc.conf:

ntpd_enable="YES"
ntpd_sync_on_start="YES"
ntpd_flags="-g"

Start the ntpd(8) service:

# service ntpd start

Power Saving

On Linux, power saving for USB devices may be enabled by default. This can cause issues if sensors are attached through an USB adapter. USB power saving is enabled if the kernel boot parameter usbcore.autosuspend is not -1:

# cat /sys/module/usbcore/parameters/autosuspend
2

We can update the boot loader to turn auto-suspend off. Edit /etc/default/grub and change GRUB_CMDLINE_LINUX_DEFAULT to:

GRUB_CMDLINE_LINUX_DEFAULT="quiet usbcore.autosuspend=-1"

Then, update the boot loader:

# update-grub

The system has to be rebooted for the changes to take effect.

Cron

On Unix-like operating system, cron is usually used to run jobs periodically. For instance, in order to update an XML feed or to generate HTML reports at regular intervals, add a schedule of the task to perform to the crontab(5) file of a local user. For example, to edit the cron jobs of user www with crontab(1) run:

# crontab -u www -e

The following crontab(5) entry adds a job to generate reports every hour, using utility script mkreport.sh:

SHELL=/bin/sh
MAILTO=/dev/null
# Create reports every hour.
@hourly /usr/local/share/dmpack/dmreport/mkreport.sh

Alter script mkreport.sh to your set-up. Status mails and logging are disabled. The shell script mkreport.sh must have the execution bits set. Modify the script according to your set-up. Additionally, we may update an Atom XML feed of logs by running dmfeed every five minutes:

*/5 * * * * /usr/local/bin/dmfeed --config /usr/local/etc/dmpack/dmfeed.conf

The feed is updated only if new logs have arrived in the meantime, unless option --force is passed as an additional argument.