Skip to content

Instantly share code, notes, and snippets.

@gdm
Created March 16, 2019 13:04
Show Gist options
  • Select an option

  • Save gdm/1448d66a76561f4640d78383758a084c to your computer and use it in GitHub Desktop.

Select an option

Save gdm/1448d66a76561f4640d78383758a084c to your computer and use it in GitHub Desktop.
hhvm.conf:
check program check-hhvm with path "/etc/monit/bin/check-hhvm.sh"
if status != 0 then alert
if status != 0
then exec "/usr/sbin/service hhvm restart"
/etc/monit/bin/check-hhvm.sh:
#!/bin/bash
HOST=yourhost
ts=$(date +%F-%H%M%S)
response=$(curl --silent -I --resolve "www.${HOST}.com:443:127.0.0.1' "https://www.${HOST}.com/?ping=$ts" | grep 'HTTP/1.1' | grep 200 )
if [ -z "$response" ]
then
exit 1
else
exit 0
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment