mrtaz65 n00b
Joined: 18 Jul 2002 Posts: 5
|
Posted: Tue Jul 23, 2002 5:13 pm Post subject: Network Link Watcher |
|
|
OK,
I may have recreated something that already exists, but I couldn't find it
I am in the process of finishing a short app that is started as a service and monitors an ethernet port by using mii-tool every second (I could make this a config option I suppose) and determining if there is a link. If there previously was no link and now there is, it runs /etc/init.d/net.eth0 start. If there was a link and it went away, it runs /etc/init.d/net.eth0 stop.
I created an ugly init script to go in /etc/init.d so I was able to add it to the default runlevel. It is a python script and this is what it does:
On start - Check for PID and running process, if it exists, don't start. If it is not already running, check state of eth0. If eth0 has link, execute /etc/init.d/net.eth0 start.
Every second, check status of eth0.
Would anyone else like to look at this? It is pretty ugly right now, but it is working for me.
If there is something better, please let me know.
MrTaz65
Lenny Brown
mrtaz@tazman.com |
|