Merge branch 'mw/config'
[aiccu.git] / debian / 60aiccu
blob29cf4877ad6aad694ab8e2af0704eff7ca07bd87
1 #!/bin/sh
2 # Restart aiccu if connection is down
4 CONFIG=/etc/aiccu.conf
5 BINARY=/usr/sbin/aiccu
6 P6=/bin/ping6
8 #. "${PM_FUNCTIONS}"
10 [ -x $BINARY ] || exit $NA
11 [ -f $CONFIG ] || exit $NA
13 function ping_root() {
14 [ -x $P6 ] || return 127
16 # Get aiccu ipv6_interface
17 INT=$(grep ^ipv6_interface $CONFIG | cut -d" " -f 2)
19 # Ping f.root-servers.net (Internet Systems Consortium; distributed using anycast)
20 $P6 -I $INT -c 1 f.root-servers.net >/dev/null 2>&1
21 return $?
24 function check_aiccu() {
25 # Restart aiccu if ping fails
26 ping_root || invoke-rc.d aiccu restart
29 case "$1" in
30 hibernate|suspend)
31 # Do nothing
33 thaw|resume)
34 check_aiccu
36 *) exit $NA
38 esac