#!/bin/sh #ASB, 20020721, sync up time using ntpdate and start ntpd start() { echo "Syncing time with ntpdate" /usr/sbin/ntpdate -s -b -p 3 $(awk '/^server/ {print $2}' /etc/ntp.conf) echo "Starting NTP daemon: /usr/sbin/ntpd" /usr/sbin/ntpd -A } stop() { killall ntpd } status() { PID="`/sbin/pidof ntpd`" echo -n "ntpd is " if [ -z "$PID" ]; then echo "stopped" else echo "running (pid $PID)" fi } case $1 in 'start') start ;; 'stop') stop ;; 'status') status ;; *) echo "Usage: $0 (start|stop|status)" exit 1 esac