So, first and foremost, I'm having issues with my internet connection. Periodically, the connection drops across the network. The fix is simple enough: restart the modem. However, this gets old when the connection dies out every hour.
I can hit my surfboard on 192.168.100.1, and navigate to a page allowing me to reset the modem remotely (which is nice). I also know I can do this via the command line using telnet, and (I think) SSHing into it, and sending it the command 'reset'.
So, I'd like to create a script that (every 5 minutes or so) pings
Comcast.net Home. If it gets a response, great, do nothing, and check again in 5 minutes.
If it doesn't, I want my computer to automatically SSH into the modem, and reset it.
I'm a programmer, but I generally bounce around with Java. Scripting is bizarre, but somewhat familiar. I know that I need the script to (generally)
-Run every 5 minutes
-ping
-store the results of the ping, preferabally in a variable, but otherwise in any readable format (I don't know if Linux is equipped with an automated text reader)
-if the results are good, do nothing
-if the results are bad:
-SSH
-Log into the SSH using the username and password (which I have)
-Pass it the command 'reset'
-Close the SSH
So, this is a pretty hefty script. I don't really know where to begin, or, more importantly, if all of these things are even possible.
I could use some input, and would greatly appreciate it.
Thank you
KFJ