]>
Commit | Line | Data |
---|---|---|
b9935303 | 1 | #!/bin/sh |
2 | # | |
3 | # ntp This shell script takes care of starting and stopping | |
4 | # ntp (NTP daemon). | |
5 | # | |
6fccad43 | 6 | # chkconfig: 2345 55 10 |
b9935303 | 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 | # Check that networking is up. | |
16 | [ "${NETWORKING}" = "no" ] && exit 0 | |
17 | ||
18 | [ -x /usr/sbin/ntpd -a -f /etc/ntp/ntp.conf ] || exit 0 | |
19 | ||
20 | # See how we were called. | |
21 | case "$1" in | |
22 | start) | |
23 | # Check if the service is already running? | |
24 | if [ ! -f /var/lock/subsys/ntp ]; then | |
25 | # Adjust time to make life easy for ntp | |
26 | # echo -n "Syncing time for ntp" | |
27 | # /usr/sbin/ntpdate -o 1 clock.llnl.gov norad.arc.nasa.gov | |
28 | # echo | |
29 | msg_starting ntp | |
7fc5e330 | 30 | daemon ntpd -c /etc/ntp/ntp.conf |
b9935303 | 31 | else |
32 | msg_Already_Running ntp | |
33 | exit 1 | |
34 | fi | |
35 | touch /var/lock/subsys/ntp | |
36 | ;; | |
37 | stop) | |
38 | # Stop daemons. | |
cea25d01 | 39 | msg_stopping ntp |
b9935303 | 40 | killproc ntpd |
41 | rm -f /var/lock/subsys/ntp | |
42 | ;; | |
43 | status) | |
cea25d01 | 44 | status ntpd |
b9935303 | 45 | ;; |
46 | restart|reload) | |
47 | $0 stop | |
48 | $0 start | |
49 | ;; | |
50 | *) | |
51 | echo "Usage: $0 {start|stop|restart|status}" | |
52 | exit 1 | |
53 | esac | |
54 | ||
55 | exit 0 |