add ntpclient count option and exit after a successful sync closes #1835 Thanks Carlos Sobrinho
git-svn-id: svn://svn.openwrt.org/openwrt/packages@7763 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
parent
3747e76558
commit
2974e09756
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
. /etc/functions.sh
|
. /etc/functions.sh
|
||||||
|
|
||||||
|
DONE=0
|
||||||
config_cb() {
|
config_cb() {
|
||||||
local cfg="$CONFIG_SECTION"
|
local cfg="$CONFIG_SECTION"
|
||||||
local cfgtype
|
local cfgtype
|
||||||
@ -12,10 +13,12 @@ config_cb() {
|
|||||||
ntp_client)
|
ntp_client)
|
||||||
config_get hostname $cfg hostname
|
config_get hostname $cfg hostname
|
||||||
config_get port $cfg port
|
config_get port $cfg port
|
||||||
|
config_get count $cfg count
|
||||||
|
|
||||||
|
[ "$DONE" = "1" ] && exit 0
|
||||||
ps x | grep 'bin/[n]tpclient' >&- || {
|
ps x | grep 'bin/[n]tpclient' >&- || {
|
||||||
route -n 2>&- | grep '^0.0.0.0' >&- && {
|
route -n 2>&- | grep '^0.0.0.0' >&- && {
|
||||||
/usr/sbin/ntpclient -h $hostname -p ${port:-123} 2>&- >&-
|
/usr/sbin/ntpclient -c ${count:-1} -s -h $hostname -p ${port:-123} 2>&- >&- && DONE=1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
;;
|
;;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user