projects
/
openwrt
/
svn-archive
/
archive.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
359efb1
)
First set time before running ntpd, fix from #1410
author
Florian Fainelli
<florian@openwrt.org>
Wed, 28 Feb 2007 12:30:57 +0000
(12:30 +0000)
committer
Florian Fainelli
<florian@openwrt.org>
Wed, 28 Feb 2007 12:30:57 +0000
(12:30 +0000)
SVN-Revision: 6426
net/ntpd/files/ntpd.init
patch
|
blob
|
history
diff --git
a/net/ntpd/files/ntpd.init
b/net/ntpd/files/ntpd.init
index fbcd746ef2e4922629a3ddf840260b95756a9456..e7ded5cd6e40029094aec1313695aeb52c151192 100644
(file)
--- a/
net/ntpd/files/ntpd.init
+++ b/
net/ntpd/files/ntpd.init
@@
-2,12
+2,21
@@
# Copyright (C) 2006 OpenWrt.org
START=60
# Copyright (C) 2006 OpenWrt.org
START=60
+
+STEP_SERVERS="pool.ntp.org pool.ntp.org pool.ntp.org"
+PIDFILE="/var/run/ntpd.pid"
+TIMEOUT="2" # in seconds
+
start() {
# ln -sf /dev/ttyS0 /dev/gps0
# /usr/sbin/setgarmin -d /dev/gps -c /etc/setgarmin.conf
start() {
# ln -sf /dev/ttyS0 /dev/gps0
# /usr/sbin/setgarmin -d /dev/gps -c /etc/setgarmin.conf
- /usr/sbin/ntpd -g
+ stop
+ for s in $STEP_SERVERS ; do
+ /usr/sbin/ntpdate -s -b -u -t "$TIMEOUT" "$s" && break
+ done
+ /usr/sbin/ntpd -g -p $PIDFILE
}
stop() {
}
stop() {
- killall ntpd
+ [ -f "$PIDFILE" ] && kill $(cat "$PIDFILE") 2>/dev/null >/dev/null
}
}