68 lines
1.1 KiB
Bash
68 lines
1.1 KiB
Bash
#! /bin/bash
|
||
#
|
||
# chronyd Start/Stop the chronyd NTP daemon.
|
||
#
|
||
# chkconfig: 345 55 10
|
||
# description: chronyd is a daemon which obtains measurements via the network \
|
||
# of the system clock’s offset relative to time servers on other \
|
||
# systems and adjusts the system time accordingly.
|
||
# processname: chronyd
|
||
# pidfile: /var/run/chronyd.pid
|
||
|
||
# Source function library.
|
||
. /etc/init.d/functions
|
||
|
||
RETVAL=0
|
||
|
||
prog="chronyd"
|
||
|
||
start() {
|
||
echo -n $"Starting $prog: "
|
||
daemon chronyd < /dev/null
|
||
RETVAL=$?
|
||
echo
|
||
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/chronyd
|
||
return $RETVAL
|
||
}
|
||
|
||
stop() {
|
||
echo -n $"Stopping $prog: "
|
||
killproc chronyd
|
||
RETVAL=$?
|
||
echo
|
||
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/chronyd
|
||
return $RETVAL
|
||
}
|
||
|
||
rhstatus() {
|
||
statusproc chronyd
|
||
}
|
||
|
||
restart() {
|
||
stop
|
||
start
|
||
}
|
||
|
||
case "$1" in
|
||
start)
|
||
start
|
||
;;
|
||
stop)
|
||
stop
|
||
;;
|
||
restart)
|
||
restart
|
||
;;
|
||
status)
|
||
rhstatus
|
||
;;
|
||
condrestart)
|
||
[ -f /var/lock/subsys/chronyd ] && restart || :
|
||
;;
|
||
*)
|
||
echo $"Usage: $0 {start|stop|status|restart|condrestart}"
|
||
exit 1
|
||
esac
|
||
|
||
exit $?
|