]> git.pld-linux.org Git - packages/ntp.git/blame - ntp.init
- full path to daemon
[packages/ntp.git] / ntp.init
CommitLineData
b9935303 1#!/bin/sh
2#
9862853a 3# ntpd This shell script takes care of starting and stopping
f0279210 4# ntp (NTP daemon).
b9935303 5#
6fccad43 6# chkconfig: 2345 55 10
9862853a 7# description: ntpd is the NTP daemon.
b9935303 8
9# Source function library.
10. /etc/rc.d/init.d/functions
11
12# Source networking configuration.
13. /etc/sysconfig/network
14
5820dfda 15# Source ntp configuration
9862853a 16. /etc/sysconfig/ntpd
5820dfda 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
9862853a 21 msg_network_down ntpd
f0279210 22 exit 1
23 fi
24else
25 exit 0
26fi
b9935303 27
93c97cc8 28[ -f /etc/ntp/ntp.conf ] || exit 0
b9935303 29
365ec4e7 30start() {
b9935303 31 # Check if the service is already running?
9862853a
MK
32 if [ ! -f /var/lock/subsys/ntpd ]; then
33 msg_starting ntpd
4387d6e5 34 daemon /usr/sbin/ntpd -c /etc/ntp/ntp.conf -p /var/run/ntpd.pid $NTPD_OPTIONS
966bd92b 35 RETVAL=$?
9862853a 36 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/ntpd
966bd92b 37 else
38 msg_already_running ntp
b9935303 39 fi
365ec4e7
ER
40}
41
42stop() {
9862853a
MK
43 if [ -f /var/lock/subsys/ntpd ]; then
44 msg_stopping ntpd
68000f77 45 killproc ntpd
9862853a 46 rm -f /var/lock/subsys/ntpd
966bd92b 47 else
9862853a 48 msg_not_running ntpd
ee2f7289 49 fi
365ec4e7
ER
50}
51
52RETVAL=0
53# See how we were called.
54case "$1" in
55 start)
56 start
57 ;;
58 stop)
59 stop
ee2f7289 60 ;;
b9935303 61 status)
cea25d01 62 status ntpd
dfecda58 63 exit $?
b9935303 64 ;;
dfecda58 65 restart|force-reload)
365ec4e7
ER
66 stop
67 start
b9935303 68 ;;
1586e25d 69 condrestart)
2f0cf68c
ER
70 # NB! don't remove: dhcpcd calls this
71 if [ -f /var/lock/subsys/ntpd ]; then
72 stop
73 start
74 fi
75 ;;
b9935303 76 *)
1586e25d 77 msg_usage "$0 {start|stop|restart|force-reload|condrestart|status}"
dfecda58 78 exit 3
b9935303 79esac
80
f0279210 81exit $RETVAL
This page took 0.034182 seconds and 4 git commands to generate.