]> git.pld-linux.org Git - packages/ntp.git/blob - ntp.init
- added path for logfile
[packages/ntp.git] / ntp.init
1 #!/bin/sh
2 #
3 # ntpd          This shell script takes care of starting and stopping
4 #               ntp (NTP daemon).
5 #
6 # chkconfig:    2345 55 10
7 # description:  ntpd is the NTP daemon.
8
9 # Source function library.
10 . /etc/rc.d/init.d/functions
11
12 # Source networking configuration.
13 . /etc/sysconfig/network
14
15 # Source ntp configuration
16 . /etc/sysconfig/ntpd
17
18 # Check that networking is up.
19 if is_yes "${NETWORKING}"; then
20         if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
21                 msg_network_down ntpd
22                 exit 1
23         fi
24 else
25         exit 0
26 fi
27
28 [ -f /etc/ntp/ntp.conf ] || exit 0
29
30 start() {
31         # Check if the service is already running?
32         if [ ! -f /var/lock/subsys/ntpd ]; then
33                 msg_starting ntpd
34                 daemon ntpd -c /etc/ntp/ntp.conf -p /var/run/ntpd.pid $NTPD_OPTIONS
35                 RETVAL=$?
36                 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/ntpd
37         else
38                 msg_already_running ntp
39         fi
40 }
41
42 stop() {
43         if [ -f /var/lock/subsys/ntpd ]; then
44                 msg_stopping ntpd
45                 killproc ntpd
46                 rm -f /var/lock/subsys/ntpd
47         else
48                 msg_not_running ntpd
49         fi
50 }
51
52 RETVAL=0
53 # See how we were called.
54 case "$1" in
55   start)
56         start
57         ;;
58   stop)
59         stop
60         ;;
61   status)
62         status ntpd
63         exit $?
64         ;;
65   restart|force-reload)
66         stop
67         start
68         ;;
69   condrestart)
70         # NB! don't remove: dhcpcd calls this
71         if [ -f /var/lock/subsys/ntpd ]; then
72                 stop
73                 start
74         fi
75         ;;
76   *)
77         msg_usage "$0 {start|stop|restart|force-reload|condrestart|status}"
78         exit 3
79 esac
80
81 exit $RETVAL
This page took 0.02653 seconds and 3 git commands to generate.