Marcus Rueckert
4b371e4ed1
Copy from home:pbleser:Utilities/chrony via accept of submit request 34235 revision 1. Request was accepted with message: reviewed ok OBS-URL: https://build.opensuse.org/request/show/34235 OBS-URL: https://build.opensuse.org/package/show/network:time/chrony?expand=0&rev=1
115 lines
3.5 KiB
Bash
115 lines
3.5 KiB
Bash
#!/bin/sh
|
|
#
|
|
# openSUSE system startup script for chronyd
|
|
# Copyright (C) 2010 Pascal Bleser <pascal.bleser@opensuse.org>
|
|
#
|
|
# This library is free software; you can redistribute it and/or modify it
|
|
# under the terms of the GNU Lesser General Public License as published by
|
|
# the Free Software Foundation; either version 2.1 of the License, or (at
|
|
# your option) any later version.
|
|
#
|
|
# This library is distributed in the hope that it will be useful, but
|
|
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
# Lesser General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU Lesser General Public
|
|
# License along with this library; if not, write to the Free Software
|
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307,
|
|
# USA.
|
|
#
|
|
# /etc/init.d/chronyd
|
|
# and its symbolic link
|
|
# /usr/sbin/rcchronyd
|
|
#
|
|
### BEGIN INIT INFO
|
|
# Provides: chronyd
|
|
# Required-Start: $syslog $remote_fs $network $time
|
|
# Should-Start: $time ypbind
|
|
# Required-Stop: $syslog $remote_fs $network $time
|
|
# Should-Stop: ypbind
|
|
# Default-Start: 3 5
|
|
# Default-Stop: 0 1 2 6
|
|
# Short-Description: Chrony daemon providing system clock synchronization
|
|
# Description: Start the chrony daemon to manage the system clock
|
|
### END INIT INFO
|
|
|
|
SERVICE=chronyd
|
|
|
|
# Check for missing binaries (stale symlinks should not happen)
|
|
# Note: Special treatment of stop for LSB conformance
|
|
CHRONYD_BIN=/usr/sbin/FOO
|
|
test -x "$CHRONYD_BIN" || { echo "$CHRONYD_BIN not installed";
|
|
if [ "$1" = "stop" ]; then exit 0;
|
|
else exit 5; fi; }
|
|
|
|
# Check for existence of needed config file and read it
|
|
CHRONYD_CONFIG="/etc/sysconfig/chronyd"
|
|
test -r "$CHRONYD_CONFIG" || { echo "$CHRONYD_CONFIG not existing";
|
|
if [ "$1" = "stop" ]; then exit 0;
|
|
else exit 6; fi; }
|
|
|
|
# Read config
|
|
. "$CHRONYD_CONFIG"
|
|
|
|
CHRONYD_USER=chrony
|
|
|
|
. /etc/rc.status
|
|
rc_reset # Reset status of this service
|
|
|
|
case "$1" in
|
|
start)
|
|
CHRONY_OPTIONS=""
|
|
[ "$CHRONY_IPV4" = "yes" -a "$CHRONY_IPV6" = "no" ] && CHRONY_OPTIONS="$CHRONY_OPTIONS -4"
|
|
[ "$CHRONY_IPV4" = "no" -a "$CHRONY_IPV6" = "yes" ] && CHRONY_OPTIONS="$CHRONY_OPTIONS -6"
|
|
[ "$CHRONY_LOCK_IN_RAM" = "yes" ] && CHRONY_OPTIONS="$CHRONY_OPTIONS -m"
|
|
echo -n "Starting $SERVICE "
|
|
/sbin/startproc "$CHRONYD_BIN" -u "$CHRONYD_USER" $CHRONY_OPTIONS
|
|
rc_status -v
|
|
;;
|
|
stop)
|
|
echo -n "Shutting down $SERVICE "
|
|
/sbin/killproc -TERM "$CHRONYD_BIN"
|
|
rc_status -v
|
|
;;
|
|
try-restart|condrestart)
|
|
if test "$1" = "condrestart"; then
|
|
echo "${attn} Use try-restart ${done}(LSB)${attn} rather than condrestart ${warn}(RH)${norm}"
|
|
fi
|
|
$0 status
|
|
if test $? = 0; then
|
|
$0 restart
|
|
else
|
|
rc_reset # Not running is not a failure.
|
|
fi
|
|
rc_status
|
|
;;
|
|
restart)
|
|
$0 stop
|
|
$0 start
|
|
rc_status
|
|
;;
|
|
force-reload)
|
|
echo -n "Reload service $SERVICE "
|
|
$0 try-restart
|
|
rc_status
|
|
;;
|
|
reload)
|
|
rc_failed 3
|
|
rc_status -v
|
|
;;
|
|
status)
|
|
echo -n "Checking for service $SERVICE "
|
|
/sbin/checkproc "$CHRONYD_BIN"
|
|
rc_status -v
|
|
;;
|
|
probe)
|
|
test /etc/chronyd.conf -nt /var/run/chronyd.pid && echo reload
|
|
;;
|
|
*)
|
|
echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload|probe}"
|
|
exit 1
|
|
;;
|
|
esac
|
|
rc_exit
|