]> git.pld-linux.org Git - packages/ntp.git/blob - ntp.init
- massive attack s/pld.org.pl/pld-linux.org/
[packages/ntp.git] / ntp.init
1 #!/bin/sh
2 #
3 # ntp           This shell script takes care of starting and stopping
4 #               ntp (NTP daemon).
5 #
6 # chkconfig:    2345 55 10
7 # description:  ntp 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/ntp
17
18 # Check that networking is up.
19 if is_yes "${NETWORKING}"; then
20         if [ ! -f /var/lock/subsys/network ]; then
21                 # nls "ERROR: Networking is down. %s can't be run." <service>
22                 msg_network_down ntp
23                 exit 1
24         fi
25 else
26         exit 0
27 fi
28
29 [ -x /usr/sbin/ntpd -a -f /etc/ntp/ntp.conf ] || exit 0
30
31
32 # See how we were called.
33 case "$1" in
34   start)
35         # Check if the service is already running?
36         if [ ! -f /var/lock/subsys/ntp ]; then
37                 if is_yes "$SYNC_TIME"; then
38                         # Adjust time to make life easy for ntp
39                         run_cmd "Syncing time for ntp" "/usr/sbin/ntpdate $NTPDATE_OPTIONS $NTPDATE_SERVERS"
40                 fi
41                 msg_starting ntp
42                 daemon ntpd -c /etc/ntp/ntp.conf
43                 RETVAL=$?
44                 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/ntp
45         else
46                 msg_already_running ntp
47                 exit 1
48         fi
49         ;;
50   stop)
51         if [ -f /var/lock/subsys/ntp ]; then
52                 msg_stopping ntp
53                 killproc ntpd
54                 rm -f /var/lock/subsys/ntp
55         else
56                 msg_not_running ntp
57                 exit 1
58         fi
59         ;;
60   status)
61         status ntpd
62         ;;
63   restart|reload)
64         $0 stop
65         $0 start
66         ;;
67   *)
68         msg_usage "$0 {start|stop|restart|reload|status}"
69         exit 1
70 esac
71
72 exit $RETVAL
This page took 0.031639 seconds and 3 git commands to generate.