Skip to content

Instantly share code, notes, and snippets.

@Lahorde
Last active February 23, 2017 08:38
Show Gist options
  • Save Lahorde/e080cb1c55e35e1ab0f6b590bf02de02 to your computer and use it in GitHub Desktop.
Save Lahorde/e080cb1c55e35e1ab0f6b590bf02de02 to your computer and use it in GitHub Desktop.
Sometimes on Raspberry, wifi connection cannot be reestablished. Check it and restart netctl auto connection to wlan0 all 5 min with a cron job
#!/bin/sh
timeout 0.4 ping -c1 google.fr > /dev/null
if [ $? != 0 ]
then
echo "not connected to network"
if iwconfig 2>/dev/null|grep -q wlan0
then
echo 'restart wlan0'
systemctl restart netctl-auto@wlan0.service
fi
fi
*/5 * * * * /usr/local/bin/check_wifi.sh
@Lahorde
Copy link
Author

Lahorde commented Feb 23, 2017

On archlinux, cronie is not installed by default. Refer this page

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment