I suppose you may say all of this can be just as easily be done via systemd service config files. Well, yes and no. Yes, it can be done. And, no, not as easily. Not even close. Because systemd sucks by design. But this is a subject for another post. For now, here’s just yet another lazy sysadmin’s scripted shortcut.

The script below will get a list of enabled services. It will then figure out which of those are not running and restart them (unless you added them to the exclude list in the script). An entry will be added to the log and you’ll get an email as well.

So nothing fancy, just a quick and dirty way to bounce dead services without getting into why they died in the first place. A bit like fixing your ceiling over and over while your roof is leaking. You can get this script from my GitHub repo as well.