hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
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
#! /bin/sh
 
# System V init script for chrony
# Adapted from the script already in meta-networking for ntpd
 
### BEGIN INIT INFO
# Provides:        chrony
# Required-Start:  $network $remote_fs $syslog
# Required-Stop:   $network $remote_fs $syslog
# Default-Start:   2 3 4 5
# Default-Stop:
# Short-Description: Start chrony time daemon
### END INIT INFO
 
PATH=/sbin:/bin:/usr/bin:/usr/sbin
 
DAEMON=/usr/sbin/chronyd
PIDFILE=/run/chrony/chronyd.pid
 
test -x $DAEMON -a -r /etc/chrony.conf || exit 0
 
# Source function library.
. /etc/init.d/functions
 
# Functions to do individual actions
startdaemon(){
   echo -n "Starting chronyd: "
   start-stop-daemon --start --quiet --oknodo --pidfile $PIDFILE --startas $DAEMON -- "$@"
   echo "done"
}
stopdaemon(){
   echo -n "Stopping chronyd: "
   start-stop-daemon --stop --quiet --oknodo -p $PIDFILE
   echo "done"
}
 
case "$1" in
  start)
   startdaemon
   ;;
  stop)
      stopdaemon
   ;;
  force-reload | restart | reload)
      stopdaemon
   startdaemon
   ;;
  status)
   status /usr/sbin/chronyd;
   exit $?
   ;;
  *)
   echo "Usage: chronyd { start | stop | status | restart | reload }" >&2
   exit 1
   ;;
esac
 
exit 0