]>
Commit | Line | Data |
---|---|---|
34360644 AM |
1 | #!/bin/sh |
2 | # | |
cd17b329 | 3 | # ntpd This shell script takes care of starting and stopping |
34360644 AM |
4 | # ntp (NTP daemon). |
5 | # | |
6 | # chkconfig: 2345 55 10 | |
cd17b329 | 7 | # description: ntpd is the NTP daemon. |
34360644 AM |
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 | |
cd17b329 | 16 | . /etc/sysconfig/ntpd |
34360644 AM |
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> | |
cd17b329 | 22 | msg_network_down ntpd |
34360644 AM |
23 | exit 1 |
24 | fi | |
25 | else | |
26 | exit 0 | |
27 | fi | |
28 | ||
34360644 AM |
29 | RETVAL=0 |
30 | # See how we were called. | |
31 | case "$1" in | |
32 | start) | |
33 | # Check if the service is already running? | |
cd17b329 | 34 | if [ ! -f /var/lock/subsys/ntpd ]; then |
75ce2b61 | 35 | msg_starting ntpd -s |
cd17b329 | 36 | daemon ntpd |
34360644 | 37 | RETVAL=$? |
cd17b329 | 38 | [ $RETVAL -eq 0 ] && touch /var/lock/subsys/ntpd |
34360644 | 39 | else |
cd17b329 | 40 | msg_already_running ntpd |
34360644 AM |
41 | fi |
42 | ;; | |
43 | stop) | |
cd17b329 AM |
44 | if [ -f /var/lock/subsys/ntpd ]; then |
45 | msg_stopping ntpd | |
46 | killproc ntpd | |
47 | rm -f /var/lock/subsys/ntpd | |
34360644 | 48 | else |
cd17b329 | 49 | msg_not_running ntpd |
34360644 AM |
50 | fi |
51 | ;; | |
52 | status) | |
cd17b329 | 53 | status ntpd |
34360644 AM |
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 |