#!/bin/sh echo "adding cron entry for NTP time synchronisation" FILE=$BASE//var/spool/cron/crontabs/root # quit if ntpdate seems to not be installed [ -x $BASE/usr/sbin/ntpdate ] || exit # quit if ntpdate seems to be in the crontab already grep -c ntpdate $FILE > /dev/null && exit # pick an arbitrary minute past the hour to run the job # we use the seconds part of the current time WHEN=`date +%S` # append the entry to the crontab echo "$WHEN * * * * /usr/sbin/ntpdate ntp.lancs.ac.uk > /dev/null" >> $FILE