Created
July 8, 2019 17:38
-
-
Save mo-han/17a0a6a7a15b1644e2960bbc5605058f to your computer and use it in GitHub Desktop.
a shell script for openwrt to sync system clock using ntpclient
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
for i in $(seq 0 3) | |
do | |
server=$i.openwrt.pool.ntp.org | |
if ping -c 3 -w 3 $server >/dev/null | |
then | |
echo $server | |
ntpclient -s -h $server | |
break | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment