]> git.pld-linux.org Git - packages/ntp.git/blob - ntp-client.init
- add some default restrictions
[packages/ntp.git] / ntp-client.init
1 #!/bin/sh
2 #
3 # ntp           This shell script takes care of starting and stopping
4 #               ntp (NTP client).
5 #
6 # chkconfig:    2345 55 10
7 # description:  ntp is the NTP client.
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 -a "$1" != stop -a "$1" != status ]; 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/ntpdate ] || exit 0
30
31 RETVAL=0
32 # See how we were called.
33 case "$1" in
34   start)
35         if is_yes "$SYNC_TIME"; then
36                 # Adjust time
37                 run_cmd "Syncing time for ntp" "/usr/sbin/ntpdate $NTPDATE_OPTIONS $NTPDATE_SERVERS"
38                 RETVAL=$?
39         fi
40         ;;
41   stop)
42         exit $RETVAL
43         ;;
44   restart|force-reload)
45         $0 start
46         exit $?
47         ;;
48   *)
49         msg_usage "$0 {start|restart|force-reload}"
50         exit 3
51 esac
52
53 exit $RETVAL
This page took 0.071103 seconds and 3 git commands to generate.