Skip to content

Instantly share code, notes, and snippets.

@binary4cat
Last active May 28, 2022 02:46
Show Gist options
  • Save binary4cat/3e4e08200cba2fd8066a3d1d0d477ff7 to your computer and use it in GitHub Desktop.
Save binary4cat/3e4e08200cba2fd8066a3d1d0d477ff7 to your computer and use it in GitHub Desktop.
mwan3 interface auto restart
#!/bin/sh
mwan3 interfaces | awk '{if($4 != "online" && NR > 1) print $2}' | while read line; do
if [[ "$line" == "WAN" ]]; then
echo "------ eth1"
ip link set eth1 down
ip link set eth1 up
elif [[ "$line" == "WAN1" ]];then
echo "---- veth11"
ip link set veth11 down
ip link set veth11 up
elif [[ "$line" == "WAN2" ]];then
echo "----- veth12"
ip link set veth12 down
ip link set veth12 up
elif [[ "$line" == "WAN3" ]];then
echo "---- veth13"
ip link set veth13 down
ip link set veth13 up
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment