Thursday, December 2, 2010

I'm a victim of this NetworkManager bug where if it can't reach the dhcp server after some longer amount of time, it gives up. I have a server that is difficult for me to reboot that has gone down because NetworkManager just gives up if something happens to the DHCP server. So, I wrote this watchdog script and put it in my crontab to run every 5 minutes.


#!/bin/bash

if pidof dhclient > /dev/null; then
logger "dhclient is alive"
else
logger "dhclient is dead, restart NetworkManager"
/etc/init.d/NetworkManager restart
fi

No comments: