File chronyd.init of Package chrony

#!/bin/bash
#
# chkconfig:    345 31 69
# description:  time syncronization
#
### BEGIN INIT INFO
# Provides:          chrony ntp ntpd
# Required-Start:    $syslog $network $remote_fs $named
# Required-Stop:     $syslog $network $remote_fs
# Default-Start:     3 4 5
# Default-Stop:      0 1 2 6
# Short-Description: time syncronization
# Description:       chronyd obtains measurements via the network of the system
#                    clock’s offset relative to time servers on other systems
#                    and adjusts the system time accordingly.
### END INIT INFO

CHRONY_BIN=/usr/sbin/chronyd
CHRONY_PID=/var/run/chronyd.pid

if [ -r /etc/rc.status ]
then
  source /etc/rc.status
  START="/sbin/startproc"
  STATUS="/sbin/checkproc"
  SUCCESS="echo \$rc_done"
  FAILURE="echo \$rc_failed"
else
  source /etc/rc.d/init.d/functions
  START="daemon"
  STATUS="status"
  SUCCESS="success; echo"
  FAILURE="failure; echo"
fi

[ -r /etc/sysconfig/chrony ] && source /etc/sysconfig/chrony

RETVAL=0

case "$1" in
  start)
    echo -n "Starting chronyd: "
    ${START} ${CHRONY_BIN} -f ${CONF_FILE:-/etc/chrony.conf} -u ${USERNAME:-ntp} ${ARGS:--r -s} > /var/log/chrony/startup.out 2>&1
    RETVAL=$?
    ;;
  stop)
    echo -n "Stopping chronyd: "
    killproc ${CHRONY_BIN}
    RETVAL=$?
    ;;
  restart)
    $0 stop
    $0 start
    unset RETVAL
    ;;
  status)
    echo -n "Status of chronyd: "
    ${STATUS} ${CHRONY_BIN} > /dev/null 2>&1
    RETVAL=$?
    ;;
  *)
    echo "Usage: $0 {start|stop|status|restart}"
    exit 1
    ;;
esac
[ -z ${RETVAL} ] && exit
[ ${RETVAL} -eq 0 ] && eval "${SUCCESS}" || eval "${FAILURE}"
exit ${RETVAL}
openSUSE Build Service is sponsored by