packages/net/ntpd/files/ntpd.init
florian fac61d23a1 First set time before running ntpd, fix from #1410
git-svn-id: svn://svn.openwrt.org/openwrt/packages@6426 3c298f89-4303-0410-b956-a3cf2f4a3e73
2007-02-28 12:30:57 +00:00

23 lines
489 B
Bash

#!/bin/sh /etc/rc.common
# 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
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() {
[ -f "$PIDFILE" ] && kill $(cat "$PIDFILE") 2>/dev/null >/dev/null
}