If you don’t mind spending money ($129) - get a smart power switch (I personally own 2 of these: Web Power Switch 7. Works great - has scripts and I’ve got both of them setup to do exactly what you’ve asked for. And as a side bonus - you can remotely power cycle stuff yourself
However, if you want a DIY solution, have a UPS-ed rPi monitoring the Voltage or external ping to something, and let the pi switch a relay to power cycle either the modem or router or both… but then… trialling and mucking about with a DIY solution, and more so the time spent, this 129USD thingy seems perfect.
Assuming oh2 is behind the router, it will show as offline. Can you use a OH2 rule with a cron job to ping a website and if not found send a reboot cmd to the router?
Or possibly have a similar script and cron job run directly on the router itself?
Can you explain what you need keys for? Are you trying to establish an SSH connection into the router to reboot it?
I do not have dd-wrt installed on my router currently, so haven’t played in a while. But can you place a script directly on the router itself? And have that script ping a website, and if the ping fails then reboot?
Yes exactly. If you don’t set up the key pairs, it prompts for the router pw. That is not something i want to put in a script.
Even better, i think i found an answer.
There is a feature in DDWRT called watchdog.
You can have it ping a website every x seconds and reboot if it fails. Go figure.