23 lines
504 B
Text
23 lines
504 B
Text
|
#!/bin/bash
|
||
|
INTERFACE=mullvad
|
||
|
shopt -s nullglob
|
||
|
|
||
|
ping -q -I $INTERFACE 8.8.8.8 -c 4 -i 1 -W 5 >/dev/null 2>&1
|
||
|
|
||
|
if test $? -eq 0; then
|
||
|
NEW_STATE=server
|
||
|
else
|
||
|
NEW_STATE=off
|
||
|
fi
|
||
|
|
||
|
for MESH in /sys/class/net/*/mesh; do
|
||
|
OLD_STATE="$(cat $MESH/gw_mode)"
|
||
|
[ "$OLD_STATE" == "$NEW_STATE" ] && continue
|
||
|
echo $NEW_STATE > $MESH/gw_mode
|
||
|
echo 54MBit/54MBit > $MESH/gw_bandwidth
|
||
|
logger "batman gateway mode changed to $NEW_STATE"
|
||
|
done
|
||
|
|
||
|
# vim: noai:ts=4:sw=4:ff=unix:ft=text:fdm=marker
|
||
|
|