2006-11-03 14:32:02 +00:00
|
|
|
NAME=ntpd
|
|
|
|
CONFIG=/etc/$NAME.conf
|
|
|
|
COMMAND=/usr/sbin/$NAME
|
|
|
|
|
2007-04-10 10:58:00 +00:00
|
|
|
. /etc/functions.sh
|
|
|
|
|
|
|
|
config_cb() {
|
|
|
|
local cfg="$CONFIG_SECTION"
|
|
|
|
local cfgtype
|
|
|
|
config_get cfgtype "$cfg" TYPE
|
|
|
|
|
|
|
|
case "$cfgtype" in
|
|
|
|
timezone)
|
|
|
|
config_get posixtz $cfg posixtz
|
|
|
|
config_get zoneinfo $cfg zoneinfo
|
|
|
|
|
|
|
|
ps x | grep 'ntpd' >&- || {
|
|
|
|
route -n 2>&- | grep '^0.0.0.0' >&- && {
|
|
|
|
echo "$posixtz" > /etc/TZ
|
|
|
|
/etc/init.d/ntpd start
|
|
|
|
}
|
|
|
|
}
|
|
|
|
;;
|
|
|
|
esac
|
2006-11-03 14:32:02 +00:00
|
|
|
}
|
2007-04-10 10:58:00 +00:00
|
|
|
|
|
|
|
case "${ACTION:-ifup}" in
|
|
|
|
ifup)
|
|
|
|
config_load timezone&
|
|
|
|
;;
|
|
|
|
ifdown)
|
|
|
|
route -n 2>&- | grep '^0.0.0.0' >&- || /etc/init.d/ntpd stop 2>&- >&-
|
|
|
|
;;
|
|
|
|
esac
|