June 7, 20197 yr I have a perhaps unusual network typology, pictured. https://imgur.com/RXVgMrF What happens is Router B often randomly looses connection (especially after long periods of no-use [eg. overnight]). To solve this problem all I have to do is reboot Router B, wait 2-3 minutes, and Router C will be connected again. Sometimes Router C stops trying to get an address on the WAN port and I have to log in and tell it to connect. What I'm after is a script where, from Unraid (or Router C) I ping Router A every minute. This might in-and-of-itself keep the connection up. If the ping fails, kill power to the WIFI switch that powers Router B (I can handle that part), then ssh into Router C and tell it to connect (I can handle that too). What I'm not sure how to do is trigger an if statement for if the ping fails. I also dont know how to make the script run on Unraid at system boot in the background. Can I put something like this in a simple docker that starts at startup? That way I can switch it on and off easily. Is there a basic lightweight docker with command line network utilities only? How would I make this? Any examples? Edited June 7, 20197 yr by Mysticle31
June 7, 20197 yr Install User Scripts plugin from Community Apps. It can schedule an sh script. You can do it on a docker but it would be more complicated.
June 8, 20197 yr Author Perfect! User Scripts. That opens the door for me to do all kinds of things. Thanks! Any idea what the best way is to write a script to monitor output from ping? Whats the best/easiest way. Other than having one script run the ping command continuously, printing the output to a file. Then another script to read the contents of the file and look for "bad" "disconnected" whatever terms ping uses. Then another script to delete the file every month or so.... complicated.
June 8, 20197 yr 24 minutes ago, Mysticle31 said: Perfect! User Scripts. That opens the door for me to do all kinds of things. Thanks! Any idea what the best way is to write a script to monitor output from ping? Whats the best/easiest way. Other than having one script run the ping command continuously, printing the output to a file. Then another script to read the contents of the file and look for "bad" "disconnected" whatever terms ping uses. Then another script to delete the file every month or so.... complicated. Can’t you simply monitor the exit status of the ping command? As I understand it 0 means success, anything else means failure.
June 9, 20197 yr I did something like this years ago, back then I had an unstable fiber modem, which just stopped passing anything through. To restart that, I wrote some code in arduino, and flashed it to a Sonoff. It would then try to access google.com, and if it had failed connecting for a few minutes, it would kill power to the modem, wait 15 seconds, then turn it back on. After that it would give it 5 minutes to start up and get connection, if it didnt, it would be power cycled again.
Archived
This topic is now archived and is closed to further replies.