UPDATE: I’ve created a tutorial on how to do this with a serverless Lambda function, which is a much more robust option. View the tutorial here.
I’ve been looking for a way to monitor my various VPS web servers and to automatically reboot them if something goes wrong but I was never able to find a simple solution. I’ve used Monit — but at times it has failed to keep my servers up and running. So I’ve created my own bash script to do the job and thought I would share it.