Subversion Repositories configs

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
3 - 1
#!/bin/bash
2
#
3
# ntpd		This shell script takes care of starting and stopping
4
#		ntpd (NTPv4 daemon).
5
#
6
# chkconfig: - 58 74
7
# description: ntpd is the NTPv4 daemon. \
8
# The Network Time Protocol (NTP) is used to synchronize the time of \
9
# a computer client or server to another server or reference time source, \
10
# such as a radio or satellite receiver or modem.
11
 
12
### BEGIN INIT INFO
13
# Provides: ntpd
14
# Required-Start: $network $local_fs $remote_fs
15
# Required-Stop: $network $local_fs $remote_fs
16
# Should-Start: $syslog $named ntpdate
17
# Should-Stop: $syslog $named
18
# Short-Description: start and stop ntpd
19
# Description: ntpd is the NTPv4 daemon. The Network Time Protocol (NTP)
20
#              is used to synchronize the time of a computer client or
21
#              server to another server or reference time source, such
22
#              as a radio or satellite receiver or modem.
23
### END INIT INFO
24
 
25
# Source function library.
26
. /etc/init.d/functions
27
 
28
# Source networking configuration.
29
. /etc/sysconfig/network
30
 
31
prog=ntpd
32
lockfile=/var/lock/subsys/$prog
33
 
34
start() {
35
	[ "$EUID" != "0" ] && exit 4
36
	[ "$NETWORKING" = "no" ] && exit 1
37
	[ -x /usr/sbin/ntpd ] || exit 5
38
	[ -f /etc/sysconfig/ntpd ] || exit 6
39
	. /etc/sysconfig/ntpd
40
 
41
        # Start daemons.
42
        echo -n $"Starting $prog: "
43
        daemon $prog $OPTIONS
44
	RETVAL=$?
45
        echo
46
	[ $RETVAL -eq 0 ] && touch $lockfile
47
	return $RETVAL
48
}
49
 
50
stop() {
51
	[ "$EUID" != "0" ] && exit 4
52
        echo -n $"Shutting down $prog: "
53
	killproc $prog
54
	RETVAL=$?
55
        echo
56
	[ $RETVAL -eq 0 ] && rm -f $lockfile
57
	return $RETVAL
58
}
59
 
60
# See how we were called.
61
case "$1" in
62
  start)
63
	start
64
	;;
65
  stop)
66
	stop
67
	;;
68
  status)
69
	status $prog
70
	;;
71
  restart|force-reload)
72
	stop
73
	start
74
	;;
75
  try-restart|condrestart)
76
	if status $prog > /dev/null; then
77
	    stop
78
	    start
79
	fi
80
	;;
81
  reload)
82
	exit 3
83
	;;
84
  *)
85
	echo $"Usage: $0 {start|stop|status|restart|try-restart|force-reload}"
86
	exit 2
87
esac