So I have a small droplet that I run a few small WordPress sites on with Nginx, HHVM, MySQL, etc.
Once a week or so, seemingly randomly, I visit sites on the server and am greeted with a “502 Bad Gateway” error from Nginx. When I investigate further in SSH, I discover that HHVM is not running.
I simply run the “sudo service hhvm start” command and everything comes up and running again.
So I have a couple questions:
Is there any reason why HHVM would suddenly stop running like I’ve described? I believe I have it included in my boot sequence and I regularly update all my packages.
Is there a way to run an automated check, maybe once every five minutes or so to check if HHVM is running, and if not, starting it?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
For an automated check, you could use a bash script. I’d force it to run “service hhvm status” and grep for running / not running.
If it came back with “not running” for example, you could restart it with “service hhvm restart”.
This may be of some use to you
I’m not very good with bash, but this would be the path I would try to use
Sorry I couldn’t be of more help.
I wrote a bash script for a similar thing ( apache and mysql ). You could easily rewrite it for other services: https://github.com/sierracircle/services-checker
It even sends you an email letting you know the service that was restarted.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.