]> git.pld-linux.org Git - packages/ntp.git/blob - ntp.init
- prefer MD5Init() from openssl libs (-lcrypto)
[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 RETVAL=0
31 # See how we were called.
32 case "$1" in
33   start)
34         # Check if the service is already running?
35         if [ ! -f /var/lock/subsys/ntpd ]; then
36                 msg_starting ntpd
37                 daemon ntpd -c /etc/ntp/ntp.conf
38                 RETVAL=$?
39                 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/ntpd
40         else
41                 msg_already_running ntp
42         fi
43         ;;
44   stop)
45         if [ -f /var/lock/subsys/ntpd ]; then
46                 msg_stopping ntpd
47                 killproc ntpd
48                 rm -f /var/lock/subsys/ntpd
49         else
50                 msg_not_running ntpd
51         fi
52         ;;
53   status)
54         status ntpd
55         exit $?
56         ;;
57   restart|force-reload)
58         $0 stop
59         $0 start
60         exit $?
61         ;;
62   *)
63         msg_usage "$0 {start|stop|restart|force-reload|status}"
64         exit 3
65 esac
66
67 exit $RETVAL
This page took 0.066946 seconds and 3 git commands to generate.