Skip to content

Instantly share code, notes, and snippets.

@shrekuu
Created December 24, 2019 09:49
Show Gist options
  • Save shrekuu/d254a3358960d0c61bb9ee1f50c6f131 to your computer and use it in GitHub Desktop.
Save shrekuu/d254a3358960d0c61bb9ee1f50c6f131 to your computer and use it in GitHub Desktop.
reconnect to wifi when wifi is down, crontab job
#!/bin/bash
# ref: https://askubuntu.com/a/421751/596437
wlan=`/sbin/ifconfig wlp2s0 | grep inet\ addr | wc -l`
if [ $wlan -eq 0 ]; then
/sbin/ifconfig wlp2s0 down && /sbin/ifconfig wlp2s0 up
else
echo "interface is up"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment