Bookmark and Share BitCoin Donate: 13t8gAWVpHP2ddxMp88d1NFpZjnFJC6UwK

I have a piece of crap HP notebook I use as a seedbox, run gentoo on it.
Something is funky with the wireless drives, they keep dying every now 
and again and when they die, the wireless get softblocked.

Here's a little script that I cron at 5 minutes intervals to check 
for connectivity and resets the wireless device if a problem occurred.

#!/bin/sh
PACKETS=1
INTERVAL=10

TARGET="www.google.co.za"
RET=`ping -c $PACKETS $TARGET 2> /dev/null | awk '/received/ {print $4}'`
MYDATE=`date +"%F %H:%M"`
if [ "$RET" -eq "$PACKETS" ]; then
        `echo 'running @' $MYDATE >> /var/log/wlan0.log`
else
        `echo 'restarting @' $MYDATE >> /var/log/wlan0.log`
        `/etc/init.d/net.wlan1 stop >> /var/log/wlan0.log`
        `/usr/sbin/rfkill unblock 0`
        `/etc/init.d/net.wlan1 start >> /var/log/wlan0.log`
fi