Skip to content

Instantly share code, notes, and snippets.

@maedoc
Last active November 3, 2022 00:44
Show Gist options
  • Save maedoc/2a87a12672622790bf4e1e5e0d27d996 to your computer and use it in GitHub Desktop.
Save maedoc/2a87a12672622790bf4e1e5e0d27d996 to your computer and use it in GitHub Desktop.
sometimes ducktape is better than a new whateva
#!/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