[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Setting hwclock --localtime fails



rdate is updating the time from timeserver, but is more lightweight than 
ntpdate. I couldn't discover a debian boot script for rdate, but it's a simple 
issue, so I added this snippet to a customized /etc/rc.local script:

NTPSERVERS="80.237.234.16 130.133.1.10"
echo "Setting system clock:"
for timeserver in $NTPSERVERS; do
   if (ping -q -c 1 -i 0.2 -W 1 $timeserver > /dev/null);
    then found=true; echo "`/usr/sbin/rdate $timeserver`"; break
    else found=false
   fi
done
$found || echo "WARNING: No timeserver was reached!"


--micha



ps. you can direct output to a specific log by using function 'log' instead of echo

log () {
logger -t "xxx_rc.local" -p $loglevel "$1"
[ "$2" = "exit" ] && exit 0
}



Reply to: