aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xexamples/var_service/ntpd/ntp.script21
1 files changed, 19 insertions, 2 deletions
diff --git a/examples/var_service/ntpd/ntp.script b/examples/var_service/ntpd/ntp.script
index 76c34bf74..8542181eb 100755
--- a/examples/var_service/ntpd/ntp.script
+++ b/examples/var_service/ntpd/ntp.script
@@ -10,12 +10,30 @@
10 10
11dt=`date '+%Y-%m-%d %H:%M:%S'` 11dt=`date '+%Y-%m-%d %H:%M:%S'`
12 12
13echo "`tail -n 199 -- "$0.log" 2>/dev/null`" >"$0.log.$$"
14
15if test x"$1" = x"unsync" \
16; then
17 # No replies for our NTP requests were seen for some time.
18 #
19 # Among more mundate cases like network outages, this happens
20 # if we ran for a LONG time (days) and ntp server's IP has changed.
21 # ntpd has no code to re-resolve peers' addresses to IPs,
22 # we need to help it:
23 #
24 echo "$dt: $1"\
25 "syncronization lost, restarting ntpd"\
26 >>"$0.log.$$"
27 mv -- "$0.log.$$" "$0.log"
28 kill $PPID
29 exit
30fi
31
13if test x"$stratum" != x"" \ 32if test x"$stratum" != x"" \
14&& test x"$poll_interval" != x"" \ 33&& test x"$poll_interval" != x"" \
15&& test 4 -ge "$stratum" \ 34&& test 4 -ge "$stratum" \
16&& test 128 -le "$poll_interval" \ 35&& test 128 -le "$poll_interval" \
17; then 36; then
18 echo "`tail -n 199 -- "$0.log" 2>/dev/null`" >"$0.log.$$"
19 echo "$dt: $1"\ 37 echo "$dt: $1"\
20 "freq_drift_ppm=$freq_drift_ppm"\ 38 "freq_drift_ppm=$freq_drift_ppm"\
21 "offset=$offset"\ 39 "offset=$offset"\
@@ -27,7 +45,6 @@ if test x"$stratum" != x"" \
27 exec hwclock --systohc 45 exec hwclock --systohc
28fi 46fi
29 47
30echo "`tail -n 199 -- "$0.log" 2>/dev/null`" >"$0.log.$$"
31echo "$dt: $1"\ 48echo "$dt: $1"\
32 "freq_drift_ppm=$freq_drift_ppm"\ 49 "freq_drift_ppm=$freq_drift_ppm"\
33 "offset=$offset"\ 50 "offset=$offset"\