From: Bruce W. <wi...@ch...> - 2005-03-24 02:01:56
|
Jason Sharpee wrote: > Hi All, > > I was wondering what code people were running to check their > internet connection to see if it is up. I see the > internet_connect_check.pl file in common and was wondering if there were > any others. (didnt see anything at first glance) I have pretty good luck with common/internet_connect_check.pl. It sets a $internet_connection object that I use with this code in code/bruce/monitors.pl: ---- # Two ways of tracking $internet_connection if ($state = state_now $internet_connection) { print_msg "Internet is $state" if state_changed $internet_connection; set $indicator_light1 ($state eq 'up') ? OFF : ON; } tie_items $internet_connection $indicator_light3, 'up', ON; tie_items $internet_connection $indicator_light3, 'down', OFF; # Restart the Linksys router if the internet is down if ((state $internet_connection eq 'down') and (state_now $internet_connection or new_minute 10)) { print_log "Restarting the router (internet is down)"; run_voice_cmd 'Reboot the router'; } ---- This code turns on/off little night lights plugged into X10 modules, so I have a visual indicator of if the internet connection is up. In addition, if the connection goes down, it reboots the router in case the problem was with the router. Bruce |