]> git.pld-linux.org Git - packages/ntp.git/blame - ntpdate.init
ntpd requires libgcc_s.so.1
[packages/ntp.git] / ntpdate.init
CommitLineData
9862853a
MK
1#!/bin/sh
2#
07249e0b 3# ntpdate This shell script synchronizes time with ntpdate (NTP client)
9862853a 4#
fb235449 5# chkconfig: 2345 16 89
07249e0b 6# description: ntpdate is the NTP client.
9862853a
MK
7
8# Source function library.
9. /etc/rc.d/init.d/functions
10
11# Source networking configuration.
12. /etc/sysconfig/network
13
d9ddddbb
ER
14# if not specified in config
15NTPDATE_USER="ntp"
16
9862853a 17# Source ntp configuration
07249e0b 18. /etc/sysconfig/ntpdate
9862853a
MK
19
20# Check that networking is up.
21if is_yes "${NETWORKING}"; then
22 if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
92517d76 23 msg_network_down "ntpdate"
9862853a
MK
24 exit 1
25 fi
26else
27 exit 0
28fi
29
d16c3548
ER
30ntpdate_background() {
31 /usr/sbin/ntpdate -s ${NTPDATE_USER:+-U $NTPDATE_USER} $NTPDATE_OPTIONS $NTPDATE_SERVERS || return $?
32
33 if is_yes "$SYNC_HWCLOCK"; then
2715b69f 34 /sbin/hwclock --systohc
92517d76 35 fi
2fc0ecc0
ER
36}
37
d16c3548
ER
38start() {
39 show "Syncing time with ntpdate (backgrounding)"
40 ntpdate_background &
41 touch /var/lock/subsys/ntpdate
42 ok
43}
44
2fc0ecc0 45stop() {
07249e0b 46 rm -f /var/lock/subsys/ntpdate
2fc0ecc0
ER
47}
48
49RETVAL=0
50# See how we were called.
51case "$1" in
4ce8312f 52 start)
2fc0ecc0 53 start
0bcd3f32 54 ;;
4ce8312f 55 stop)
2fc0ecc0 56 stop
9862853a 57 ;;
4ce8312f 58 restart|force-reload)
2fc0ecc0
ER
59 stop
60 start
61 ;;
4ce8312f 62 *)
9862853a
MK
63 msg_usage "$0 {start|restart|force-reload}"
64 exit 3
65esac
66
67exit $RETVAL
This page took 0.362164 seconds and 4 git commands to generate.