summaryrefslogtreecommitdiffstats
path: root/contrib/erik_bryer_1
blob: c551dfeb15d95a911ef2ba7c8e8a19a851566657 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/bin/sh
#
# chrony        Start time synchronization. This script
#               starts chronyd.
#
# Hacked by:    Erik Bryer <ebryer@spots.ab.ca> using inet as a template
#
# chkconfig: 2345 02 82
# description: chronyd helps keep the system time accurate by calculating \
#              and applying correction factors to compensate for the drift \
#              in the clock. chronyd can also correct the hardware clock \
#              (RTC) on some systems.
# processname: chronyd
# config: /etc/chrony.conf

# Source function library.
. /etc/rc.d/init.d/functions

# Source networking configuration.
. /etc/sysconfig/network

# Set path to include chronyd in /usr/local/sbin
PATH="$PATH:/usr/local/sbin"

[ -f /usr/local/sbin/chronyd ] || exit 0

[ -f /etc/chrony.conf ] || exit 0

RETVAL=0

# See how we were called.
case "$1" in
  start)
        # Start daemons.
        echo -n "Starting chronyd: "
        daemon chronyd
	RETVAL=$?
 	[ $RETVAL -eq 0 ] && touch /var/lock/subsys/chrony
	echo
        ;;
  stop)
        # Stop daemons.
        echo -n "Shutting down chronyd: "
# If not dead killproc automatically sleeps for 4.1 seconds then does 
# kill -9. "chrony.txt" prefers a 5 second delay, but this should be ok.
        killproc chronyd -15
	RETVAL=$?
	[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/chrony
        echo
        ;;
  status)
	status chronyd
	exit $?
	;;
  restart)
	$0 stop
	$0 start
	;;
  *)
        echo "Usage: named {start|stop|status|restart}"
        exit 1
esac

exit $RETVAL