Last active
November 3, 2022 00:44
-
-
Save maedoc/2a87a12672622790bf4e1e5e0d27d996 to your computer and use it in GitHub Desktop.
sometimes ducktape is better than a new whateva
This file contains hidden or 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
#!/bin/bash | |
wifi=wlo1 | |
# maybe change to dns or whateva | |
router=192.168.1.254 | |
count=0 | |
while true | |
do | |
if ! ping -c 1 $router &> /dev/null | |
then | |
nmcli device disconnect $wifi &> /dev/null | |
nmcli device connect $wifi &> /dev/null | |
count=$(($count + 1)) | |
echo $(date +%y/%m/%d+%Hh%M) restarted $count times | |
fi | |
sleep 1 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment