summaryrefslogtreecommitdiff
path: root/examples/var_service/ntpd/ntp.script
blob: 90299ae8efef3bc06ada5b7ab00fddcb3c717b8f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/sh

exec 2>/dev/null
echo "`tail -n 99 "$0.log"`" >"$0.log"

exec >>"$0.log"
exec 2>&1

dt=`date '+%Y-%m-%d %H:%M:%S'`

if test x"$stratum" != x"" \
&& test x"$poll_interval" != x"" \
&& test 4 -ge "$stratum" \
&& test 128 -le "$poll_interval" \
; then
	echo "$dt: $1"\
		"freq_drift_ppm=$freq_drift_ppm"\
		"offset=$offset"\
		"stratum=$stratum"\
		"poll_interval=$poll_interval,"\
		"setting hardware clock"
	exec hwclock --systohc
fi

echo "$dt: $1"\
	"freq_drift_ppm=$freq_drift_ppm"\
	"offset=$offset"\
	"stratum=$stratum"\
	"poll_interval=$poll_interval"\