mirror of
https://github.com/openwrt/packages.git
synced 2025-12-26 11:16:31 +04:00
use ntpq to check the status of the ntp server as all other status scripts included in the ntp tarball are based on perl which would dramatically increase the footprint of ntpd Signed-off-by: Peter Wagner <tripolar@gmx.at>
16 lines
250 B
Bash
16 lines
250 B
Bash
#!/bin/sh
|
|
|
|
HOTPLUG_SCRIPT=/usr/sbin/ntpd-hotplug
|
|
|
|
while true
|
|
do
|
|
STATUS="$(ntpq -c 'rv 0 stratum'|awk -F '=' '{ print $2 }')"
|
|
|
|
if [ -n "$STATUS" ] && [ "$STATUS" -lt "16" ]
|
|
then
|
|
ACTION="stratum" /sbin/hotplug-call ntp
|
|
exit 0
|
|
fi
|
|
sleep 10
|
|
done
|