I sent him this script and it seems to be doing the job:
#!/bin/bash
########################################################################
#
# we need to be able to restart the network-manager to reconnect
# automatically. this usually requires us to type our password, but
# since we want to be able to run this unattended, we need to tell
# sudo that we can restart network-manager without typing our password
# to set that up, run these two commands in a terminal while logged in
# as your regular user:
#
# echo "$(whoami) ALL=(ALL) NOPASSWD: /etc/init.d/network-manager" | sudo tee /etc/sudoers.d/network-manager
# sudo chmod 0440 /etc/sudoers.d/network-manager
#
########################################################################
# how long, in seconds, to wait between ping attempts
pause=10
########################################################################
# find the address of our router
router=$(route | grep ^default | awk '{print $2}')
if [[ -z $router ]]
then
echo "can't determine router - is network down already?"
exit 1
fi
while true
do
echo "$(date) pinging router '$router'"
if ! ping -c 1 $router > /dev/null
then
echo "$(date) ping failed; restarting network-manager"
sudo /etc/init.d/network-manager restart
# give it a minute to reconnect before we start checking again
sleep 60
fi
sleep $pause
done
The two commands mentioned in comments at the top of the script need to be run if you want to run the script as a regular user and have it be able to restart the network-manager without prompting for a password.
The script needs to be saved to a file, then set as executable ("chmod +x scriptname").
It can be run automatically on login by putting
/path/to/script/scriptname &
in .xprofile in your home directory, which probably doesn't exist. Just make it.
In my case, that's "/home/chris/bounce &", but call it what you like and put it where you like.