fix examples which used non-standard cut -b0-NNN
[oweals/busybox.git] / examples / var_service / ntpd / ntp.script
1 #!/bin/sh
2
3 exec 2>/dev/null
4 echo "`tail -n 99 "$0.log"`" >"$0.log"
5
6 exec >>"$0.log"
7 exec 2>&1
8
9 dt=`date '+%Y-%m-%d %H:%M:%S'`
10
11 if test x"$stratum" != x"" \
12 && test x"$poll_interval" != x"" \
13 && test 4 -ge "$stratum" \
14 && test 128 -le "$poll_interval" \
15 ; then
16         echo "$dt: $1"\
17                 "freq_drift_ppm=$freq_drift_ppm"\
18                 "offset=$offset"\
19                 "stratum=$stratum"\
20                 "poll_interval=$poll_interval,"\
21                 "setting hardware clock"
22         exec hwclock --systohc
23 fi
24
25 echo "$dt: $1"\
26         "freq_drift_ppm=$freq_drift_ppm"\
27         "offset=$offset"\
28         "stratum=$stratum"\
29         "poll_interval=$poll_interval"\