]>
Commit | Line | Data |
---|---|---|
e91b9f68 A |
1 | #!/bin/sh |
2 | ||
3 | ## | |
4 | # Network Time | |
5 | ## | |
6 | ||
7 | . /etc/rc.common | |
8 | ||
9 | StartService () | |
10 | { | |
11 | if [ "${TIMESYNC:=-YES-}" = "-YES-" ] && | |
12 | ! GetPID ntpd > /dev/null; then | |
13 | ||
14 | CheckForNetwork | |
15 | ||
16 | if [ -f /var/run/NetworkTime.StartupItem -o "${NETWORKUP}" = "-NO-" ]; then exit; fi | |
17 | touch /var/run/NetworkTime.StartupItem | |
18 | ||
19 | ||
20 | echo "Starting network time synchronization" | |
21 | ||
22 | # Synchronize our clock to the network's time, | |
23 | # then fire off ntpd to keep the clock in sync. | |
24 | ntpdate -bvs | |
25 | ntpd -f /var/run/ntp.drift -p /var/run/ntpd.pid | |
26 | fi | |
27 | } | |
28 | ||
29 | StopService () | |
30 | { | |
31 | if pid=$(GetPID ntpd); then | |
32 | echo "Stopping network time synchronization" | |
33 | kill -TERM "${pid}" | |
34 | else | |
35 | echo "ntpd is not running." | |
36 | fi | |
37 | rm -f /var/run/NetworkTime.StartupItem | |
38 | } | |
39 | ||
40 | RestartService () { StopService; StartService; } | |
41 | ||
42 | RunService "$1" |