raspberry pi wifi test and reset wlan0

Hello,
I’ve been having problems with my network connection, thank you Verizon … ;-(

Anyways, sometimes my raspberry pi gets hung on a network reset. Did a little searching and wondered if this could be included in the Volumio code base. (or if I should just add it myself)
Anyways, from this link: weworkweplay.com/play/rebooting- … tion-wifi/

store this script in /usr/local/bin/checkwifi.sh

ping -c4 192.168.1.1 > /dev/null
if [ $? != 0 ] 
then
  echo "No network connection, restarting wlan0"
  /sbin/ifdown 'wlan0'
  sleep 5
  /sbin/ifup --force 'wlan0'
fi

make sure permissions are correct, with:

sudo chmod 775 /usr/local/bin/checkwifi.sh

and to stuff the above in cron like:

crontab -e

*/5 * * * * /usr/bin/sudo -H /usr/local/bin/checkwifi.sh >> /dev/null 2>&1

hmm, how can i get cron to run above script every 5 minutes? anyone have other solutions?

i only see /etc/cron.hourly and /etc/cron.daily

yeah, my wifi gets reset when I’m listening, and frustratingly walk over and unplug/plug my pi in.

Your crontab is already set for 5 mins.

doesn’t the cron tab file /etc/cron.hourly only run once an hour?

I just added the file to the directory, since my volumio distro didn’t have crontab … (er, that I could find)

Thanks, appreciate the response