#!/bin/sh echo "adding cron entry for NTP time synchronisation" FILE=${INSTALL_DST}/var/spool/cron/crontabs/root # quit if ntpdate seems to not be installed [ -x ${INSTALL_DST}/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 ntp0.lancs.ac.uk ntp1.lancs.ac.uk > /dev/null" >> ${FILE}