Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Automatically restart network on lost connection ' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Automatically restart network on lost connection
Authored by: desepticon on Apr 30, '12 05:40:33PM

Okay here's the missing script that checks the active interface just in case anyone wants it. This step is part of figuring out if you have an ethernet or airport connection, and really isn't needed unless you run both. Otherwise just use one script or the other. Also, a user above me made this into a much nicer script that I'm now using as well so you probably just scrap the original thing entirely. But, here it is just for posterity:

-------------------------------------------------------------------------------------------------------------------
#!/bin/sh

for iface in `ifconfig -lu` ; do
case $iface in
lo*) continue ;;
esac
ifconfig $iface | grep -q 'inet ' && echo $iface
done
-------------------------------------------------------------------------------------------------------------------

Thanks to the user who suggested a more simple way to do this. This is one of the first bash scripts I have made so I appreciate any suggestions. I also like the idea to ping the router first and then an outside address. That makes a lot of sense.

I myself am not using airport, but ethernet. Yet I still have this issue on lion.

For the user who wants to know how to use launchctl, I suggest looking at a tutorial or two and then using the app "Lingon". It makes things a whole lot easier. But you do still have to understand the basic concepts.

Edited on Apr 30, '12 05:54:22PM by desepticon



[ Reply to This | # ]