]> git.pld-linux.org Git - packages/openntpd.git/blob - openntpd.init
01fa363c11cdd81267d9fcbce970ed583822eb75
[packages/openntpd.git] / openntpd.init
1 #!/bin/sh
2 #
3 # openntpd              This shell script takes care of starting and stopping
4 #               ntp (NTP daemon).
5 #
6 # chkconfig:    2345 55 10
7 # description:  openntpd 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/openntpd
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                 # nls "ERROR: Networking is down. %s can't be run." <service>
22                 msg_network_down openntpd
23                 exit 1
24         fi
25 else
26         exit 0
27 fi
28
29 RETVAL=0
30 # See how we were called.
31 case "$1" in
32   start)
33         # Check if the service is already running?
34         if [ ! -f /var/lock/subsys/openntpd ]; then
35                 msg_starting openntpd
36                 daemon openntpd
37                 RETVAL=$?
38                 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/openntpd
39         else
40                 msg_already_running openntpd
41         fi
42         ;;
43   stop)
44         if [ -f /var/lock/subsys/openntpd ]; then
45                 msg_stopping openntpd
46                 killproc openntpd
47                 rm -f /var/lock/subsys/openntpd
48         else
49                 msg_not_running openntpd
50         fi
51         ;;
52   status)
53         status openntpd
54         exit $?
55         ;;
56   restart|force-reload)
57         $0 stop
58         $0 start
59         exit $?
60         ;;
61   *)
62         msg_usage "$0 {start|stop|restart|force-reload|status}"
63         exit 3
64 esac
65
66 exit $RETVAL
This page took 0.044827 seconds and 2 git commands to generate.