| Server IP : 134.236.49.22 / Your IP : 216.73.216.114 Web Server : Apache/2.2.15 (Fedora) System : Linux km10.dyndns.org 2.6.31.5-127.fc12.i686.PAE #1 SMP Sat Nov 7 21:25:57 EST 2009 i686 User : apache ( 48) PHP Version : 5.3.3 Disable Function : NONE MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /etc/rc5.d/ |
Upload File : |
#!/bin/bash
#
# chkconfig: - 57 75
# description: set the date and time via NTP
### BEGIN INIT INFO
# Provides: ntpdate
# Required-Start: $network $local_fs $remote_fs
# Should-Start: $syslog $named
# Short-Description: set the date and time via NTP
# Description: ntpdate sets the local clock by polling NTP servers
### END INIT INFO
# Source function library.
. /etc/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
prog=ntpdate
lockfile=/var/lock/subsys/$prog
ntpconf=/etc/ntp.conf
ntpstep=/etc/ntp/step-tickers
start() {
[ "$EUID" != "0" ] && exit 4
[ "$NETWORKING" = "no" ] && exit 1
[ -x /usr/sbin/ntpdate ] || exit 5
[ -f /etc/sysconfig/ntpdate ] || exit 6
. /etc/sysconfig/ntpdate
[ -f $ntpstep ] && tickers=$(sed 's/#.*//' $ntpstep) || tickers=
if ! echo "$tickers" | grep -qi '[a-z0-9]' && [ -f $ntpconf ]; then
# step-tickers doesn't specify a server,
# use servers from ntp.conf instead
tickers=$(awk '$1=="peer"||$1=="server"{print $2}' $ntpconf | \
egrep -v '127\.127\.[0-9]+\.[0-9]+')
fi
if ! echo "$tickers" | grep -qi '[a-z0-9]'; then
echo $"NTP server not specified in $ntpstep or $ntpconf"
exit 6
fi
echo -n $"$prog: Synchronizing with time server: "
/usr/sbin/ntpdate $OPTIONS $tickers &> /dev/null
RETVAL=$?
[ $RETVAL -eq 0 ] && success || failure
echo
if [ $RETVAL -eq 0 ]; then
touch $lockfile
[ "$SYNC_HWCLOCK" = "yes" ] && \
action $"Syncing hardware clock to system time" \
/sbin/hwclock --systohc
fi
return $RETVAL
}
status() {
[ -f $lockfile ] || return 3
}
stop() {
[ "$EUID" != "0" ] && exit 4
rm -f $lockfile
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status
;;
restart|force-reload)
stop
start
;;
*)
echo $"Usage: $0 {start|stop|status|restart|force-reload}"
exit 2
esac