packages/net/chrony/files/ntpd.hotplug
agb 83ccee9c38 packages: Use OpenWrt ntp vendor pool in default configs. (Cleaned whitespace too.)
git-svn-id: svn://svn.openwrt.org/openwrt/packages@10189 3c298f89-4303-0410-b956-a3cf2f4a3e73
2008-01-14 10:38:27 +00:00

22 lines
412 B
Plaintext

COMMAND=/usr/bin/chronyc
CHRONY_KEY=$(awk '/^1 / { print $2; }' /etc/chrony/chrony.keys)
chrony_control() {
$COMMAND << EOF
password $CHRONY_KEY
$1
EOF
}
[ "$ACTION" = "ifup" -a "$INTERFACE" = "wan" ] && {
[ -x $COMMAND ] && [ -n "$CHRONY_KEY" ] &&{
chrony_control online
}
}
[ "$ACTION" = "ifdown" -a "$INTERFACE" = "wan" ] && {
[ -x $COMMAND ] && [ -n "$CHRONY_KEY" ] &&{
chrony_control offline
}
}