Last active
September 22, 2016 08:23
-
-
Save tomazzaman/13da35056017d7b8cf00 to your computer and use it in GitHub Desktop.
Restart HHVM with Monit
This file contains 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
# This file should be in /etc/monit/conf.d | |
check process hhvm with pidfile /var/run/hhvm/pid | |
group hhvm | |
# Start program calls our custom script from above | |
start program = "/usr/local/sbin/start_hhvm.sh" | |
stop program = "/usr/sbin/service hhvm stop" | |
if failed unixsocket /var/run/hhvm/hhvm.sock then restart | |
if mem > 400.0 MB for 1 cycles then restart | |
if 5 restarts with 5 cycles then timeout |
This file contains 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 | |
# This file should be saved in /usr/local/sbin | |
# It must exist because sometime a crashed process | |
# leaves a socket behind, rendering it unstartable | |
# So what we do is test whether the socket file | |
# leftover is there and delete it. Also, make sure | |
# this file is executable: $ chmod +x start_hhvm.sh | |
SOCKET=/var/run/hhvm/hhvm.sock | |
if [ -e $SOCKET ]; | |
then | |
rm -f $SOCKET | |
fi | |
/usr/sbin/service hhvm start | |
exit 0; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For the record, I've had success with using the "restart"
/usr/sbin/service hhvm restart
into the "start program" directive.