blob: 04f1b681c43aaec3737c6c1a7607409f34be5065 [file] [log] [blame]
Patrick Williamsddad1a12017-02-23 20:36:32 -06001#! /bin/sh
2
3# System V init script for chrony
4# Adapted from the script already in meta-networking for ntpd
5
6### BEGIN INIT INFO
7# Provides: chrony
8# Required-Start: $network $remote_fs $syslog
9# Required-Stop: $network $remote_fs $syslog
10# Default-Start: 2 3 4 5
11# Default-Stop:
12# Short-Description: Start chrony time daemon
13### END INIT INFO
14
15PATH=/sbin:/bin:/usr/bin:/usr/sbin
16
17DAEMON=/usr/sbin/chronyd
18PIDFILE=/var/run/chronyd.pid
19
20test -x $DAEMON -a -r /etc/chrony.conf || exit 0
21
22# Source function library.
23. /etc/init.d/functions
24
25# Functions to do individual actions
26startdaemon(){
27 echo -n "Starting chronyd: "
28 start-stop-daemon --start --quiet --oknodo --pidfile $PIDFILE --startas $DAEMON -- "$@"
29 echo "done"
30}
31stopdaemon(){
32 echo -n "Stopping chronyd: "
33 start-stop-daemon --stop --quiet --oknodo -p $PIDFILE
34 echo "done"
35}
36
37case "$1" in
38 start)
39 startdaemon
40 ;;
41 stop)
42 stopdaemon
43 ;;
44 force-reload | restart | reload)
45 stopdaemon
46 startdaemon
47 ;;
48 status)
49 status /usr/sbin/chronyd;
50 exit $?
51 ;;
52 *)
53 echo "Usage: chronyd { start | stop | status | restart | reload }" >&2
54 exit 1
55 ;;
56esac
57
58exit 0