Skip to content

Instantly share code, notes, and snippets.

@mo-han
Created July 8, 2019 17:38
Show Gist options
  • Save mo-han/17a0a6a7a15b1644e2960bbc5605058f to your computer and use it in GitHub Desktop.
Save mo-han/17a0a6a7a15b1644e2960bbc5605058f to your computer and use it in GitHub Desktop.
a shell script for openwrt to sync system clock using ntpclient
#!/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