Last active
May 6, 2022 21:20
-
-
Save corck/d4c63e3908548963ce2e58b45d9976e2 to your computer and use it in GitHub Desktop.
Restart Networkmanager on connection reset, restart VPN after network manager restart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
For monitoring Network Manager connection and restart it on a dropped connection (eth/wifi). Make sure to specify the right interface below (eth0, wlan0...) | |
#/etc/init/reconnect.conf | |
start on started network-manager | |
stop on runlevel [016] | |
script | |
while true; do | |
if ifconfig eth0 | grep -q "inet addr:"; then | |
# echo "all ok!" | |
else | |
restart network-manager | |
fi | |
sleep 5 | |
done | |
end script | |
from `http://askubuntu.com/questions/71528/make-network-manager-restart-after-dropped-connection` | |
Make sure openvpn restarts after Network Manager restart. For some reason my system (Debian) did not run the scripts in | |
`/etc/network/if-up.d/` so I created one in `/etc/NetworkManager/dispatch.d` that restarts my VPN after | |
a network manager restart | |
#/etc/NetworkManager/dispatcher.d/02script | |
#!/bin/sh -e | |
if [ "$2" = "up" ]; then | |
/etc/init.d/openvpn restart vlora1 | |
fi | |
exit $? | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In the first script, make sure you set the proper interface that you want to monitor:
eth0
orwlan0
.....