blob: d70fffb021ccd28c1cafc767b416a9a21ee1553a (
plain)
1 #!/bin/sh
2 #
3 # /etc/rc.d/chronyd: start/stop the chrony time server
4 #
5
6 SSD=/sbin/start-stop-daemon
7 PROG=/usr/sbin/chronyd
8 OPTS="-r"
9
10 case $1 in
11 start)
12 install -o chrony -g chrony -m 0750 -d /run/chrony
13 $SSD --start --exec $PROG -- $OPTS
14 ;;
15 stop)
16 $SSD --stop --retry 10 --exec $PROG
17 ;;
18 restart)
19 $0 stop
20 $0 start
21 ;;
22 online)
23 /usr/bin/chronyc online
24 ;;
25 offline)
26 /usr/bin/chronyc << EOF > /dev/null
27 offline
28 dump
29 writertc
30 EOF
31 ;;
32 status)
33 $SSD --status --exec $PROG
34 case $? in
35 0) echo "$PROG is running with pid $(pidof $PROG)" ;;
36 1|3) echo "$PROG is not running" ;;
37 4) echo "Unable to determine the program status" ;;
38 esac
39 ;;
40 *)
41 echo "usage: $0 [start|stop|restart|online|offline|status]"
42 ;;
43 esac
44
45 # End of file
|