Skip to content

Instantly share code, notes, and snippets.

@yustein
Forked from tomazzaman/hhvm.conf
Last active August 29, 2015 14:19
Show Gist options
  • Save yustein/28a708631c48b14948dd to your computer and use it in GitHub Desktop.
Save yustein/28a708631c48b14948dd to your computer and use it in GitHub Desktop.
# 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
#!/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 restart
exit 0;
@yustein
Copy link
Author

yustein commented Apr 19, 2015

in start_hhvm.sh

service hhvm start

had to change to

service hhvm restart

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment