#!/bin/ash . /opt/openslx/config || { echo "Could not source config!"; exit 1; } [ -z "$SLX_NTP_SERVER" ] && exit 0 for SERVER in $SLX_NTP_SERVER; do if ntpdate -u -p 2 "$SERVER"; then echo "Successfully queried $SERVER for time." if [ "x$SLX_BIOS_CLOCK" = "xlocal" ]; then usleep 100000 /opt/openslx/sbin/hwclock -l -w || echo "... but could not set BIOS clock to localtime" elif [ "x$SLX_BIOS_CLOCK" = "xutc" ]; then usleep 100000 /opt/openslx/sbin/hwclock -u -w || echo "... but could not set BIOS clock to UTC" fi exit 0 fi echo "Error querying $SERVER for current time." done [ ! -z "$SLX_NTP_SERVER" ] && slxlog "ntpdate" "No NTP server was reachable. Please check SLX_NTP_SERVER in your config file." >&2 exit 1