2006-08-06 12:40:15 +00:00
|
|
|
#!/bin/sh
|
2006-10-04 20:57:49 +00:00
|
|
|
# Copyright (C) 2006 OpenWrt.org
|
|
|
|
|
2006-08-06 12:40:15 +00:00
|
|
|
ntp_server=$(nvram get ntp_server)
|
|
|
|
case "${ACTION:-ifup}" in
|
|
|
|
ifup)
|
|
|
|
ps x | grep 'bin/[n]tpclient' >&- || {
|
|
|
|
route -n 2>&- | grep '^0.0.0.0' >&- && /usr/sbin/ntpclient -c 1 -s -h ${ntp_server:-pool.ntp.org} &
|
|
|
|
}
|
|
|
|
;;
|
|
|
|
ifdown)
|
|
|
|
route -n 2>&- | grep '^0.0.0.0' >&- || killall ntpclient 2>&- >&- ;;
|
|
|
|
esac
|