Would this "reboot on ping failure" technique work with DietPi?

Hi there. I’m trying to work out if this crontab version would work,

Or is there some better way using systemd for instance?

It should work, but for me it’s not clear how a reboot should solve the disconnection. You could also try a ifdown and ifup of the interface, instead of a whole reboot.


Question is why this would be needed? Some more background information could be helpful to understood the use case.

Maybe something interesting for you. A similar case Watchdog for Dietpi (Auto reboot if Internet is down)

Hi Joulinar

The headless pi4 in question is running three main tasks - a private PaperMC server, Pihole with DNS, and Jellyfin.

Sometimes PaperMC or Jellyfin causes the pi4 to crash or stall (for various reasons I’m trying to iron out) - but as Pihole with DNS is also my home network’s DHCP server, a crash means the whole network stops functioning properly and I lose ability to SSH the pi4 for a restart manually.

If there’s some more elegant solution to restarting the pi, let me know! Thanks for your input so far.

Have a look to the link I shared above.

Thanks, I’ll take a look. Would running watchdog take the same amount of system resources as the crontab method do you think?

Honestly I don’t know. But shouldn’t be that much.

1 Like