9e06529e14a924cf0ece46b2a262fb02afd911bd
[openwrt/svn-archive/archive.git] / net / chrony / files / ntpd.hotplug
1 COMMAND=/usr/bin/chronyc
2 CHRONY_KEY=$(awk '/^1 / { print $2; }' /etc/chrony/chrony.keys)
3
4 chrony_control() {
5 $COMMAND << EOF
6 password $CHRONY_KEY
7 $1
8 EOF
9 }
10
11 [ "$ACTION" = "ifup" -a "$INTERFACE" = "wan" ] && {
12 [ -x $COMMAND ] && [ -n "$CHRONY_KEY" ] &&{
13 chrony_control online
14 }
15 }
16
17 [ "$ACTION" = "ifdown" -a "$INTERFACE" = "wan" ] && {
18 [ -x $COMMAND ] && [ -n "$CHRONY_KEY" ] &&{
19 chrony_control offline
20 }
21 }