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