Created
September 11, 2014 04:51
-
-
Save octalmage/01c702473e2af6c4a2ee to your computer and use it in GitHub Desktop.
Automatically restart HHVM if a url is returning a 502. I'm using the HHVM nightlies to take advantage of some new features, but it will occasionally stop responding to requests. Add this to your crontab to run every minute.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
response=$(curl -L --write-out %{http_code} --silent --output /dev/null jason.stallin.gs); | |
echo $response | |
if [ "$response" = "502" ] | |
then | |
service hhvm restart | |
fi |
That worked for me! Sorry just saw this.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Looks promising. Because I still get 502 sometimes. How to use this? I'm not sure if
* * * * * /root/autorestart.sh
wil work as a cronjob