0
0
mirror of https://github.com/openwrt/packages.git synced 2025-02-22 15:26:15 +00:00
packages/net/ntpd/files/ntpd.hotplug-helper
Peter Wagner 04654291a4 ntpd: *mimic the behaviour of the busybox ntpd's "-S" flag
*create a seperate line for every server, otherwise only the first listed server will be used
2018-01-02 15:19:23 +01:00

16 lines
248 B
Bash

#!/bin/sh
SLEEPTIME=10
while true
do
STATUS="$(/usr/sbin/ntpq -c 'rv 0 stratum'|awk -F '=' '{ print $2 }')"
if [[ -n "$STATUS" && "$STATUS" -lt "16" ]]
then
ACTION="stratum" /sbin/hotplug-call ntp
SLEEPTIME=660
fi
sleep $SLEEPTIME
done