#!/bin/sh # $Id: synclock.sh,v 1.1 2003/05/01 09:44:57 cws Exp $ CHECK_GATEWAY=NO # start if [ "x$1" = "x" -o "x$1" = "xstart" ]; then ROUTE=/sbin/route NTPDATE=/usr/sbin/ntpdate GREP=/usr/bin/grep AWK=/usr/bin/awk PING=/sbin/ping ntpd="192.5.41.41 132.163.4.102 129.6.15.28" #ntpd="132.163.4.102 129.6.15.28 128.138.140.44 137.189.6.18 165.21.110.7 63.149.208.50 216.200.93.8 205.188.185.33" if [ $CHECK_GATEWAY = "YES" ] then gateway=`$ROUTE -n get default | $GREP gateway | $AWK -F":" '{print $2}' `; if [ "X$gateway" = "X" ] then echo "No gateway found" exit 1 fi #Ping gateway $PING -c 1 -t 1 -q $gateway 2>&1 > /dev/null if [ $? -ne 0 ] then echo "Can not reach gateway [$gateway ]" exit 2 fi fi $NTPDATE -s $ntpd fi