]> git.pld-linux.org Git - packages/ntp.git/blame - ntpd.init
ntpd requires libgcc_s.so.1
[packages/ntp.git] / ntpd.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
d9ddddbb 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 32 if [ ! -f /var/lock/subsys/ntpd ]; then
d9ddddbb 33 msg_starting "ntpd"
4aef70db 34 daemon /usr/sbin/ntpd -c /etc/ntp/ntp.conf -p /var/run/ntpd.pid -u ntp:ntp $NTPD_OPTIONS
966bd92b 35 RETVAL=$?
9862853a 36 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/ntpd
966bd92b 37 else
d9ddddbb 38 msg_already_running "ntpd"
b9935303 39 fi
365ec4e7
ER
40}
41
42stop() {
9862853a 43 if [ -f /var/lock/subsys/ntpd ]; then
d9ddddbb 44 msg_stopping "ntpd"
68000f77 45 killproc ntpd
9862853a 46 rm -f /var/lock/subsys/ntpd
966bd92b 47 else
d9ddddbb 48 msg_not_running "ntpd"
ee2f7289 49 fi
365ec4e7
ER
50}
51
3130aa68
ER
52condrestart() {
53 if [ -f /var/lock/subsys/ntpd ]; then
54 stop
55 start
56 else
d9ddddbb 57 msg_not_running "ntpd"
3130aa68
ER
58 RETVAL=$1
59 fi
60}
61
365ec4e7
ER
62RETVAL=0
63# See how we were called.
64case "$1" in
65 start)
4ce8312f 66 start
365ec4e7
ER
67 ;;
68 stop)
4ce8312f 69 stop
ee2f7289 70 ;;
3130aa68
ER
71 restart)
72 stop
73 start
74 ;;
75 # NB! don't remove 'condrestart': dhcpcd calls this
76 try-restart|condrestart)
77 condrestart 0
78 ;;
79 force-reload)
80 condrestart 7
81 ;;
b9935303 82 status)
cea25d01 83 status ntpd
dfecda58 84 exit $?
b9935303 85 ;;
b9935303 86 *)
3130aa68 87 msg_usage "$0 {start|stop|restart|try-restart|force-reload|condrestart|status}"
dfecda58 88 exit 3
b9935303 89esac
90
f0279210 91exit $RETVAL
This page took 0.096563 seconds and 4 git commands to generate.