Skip to content

Instantly share code, notes, and snippets.

@angelflo
Forked from fer-ri/restart-service.sh
Created June 1, 2019 04:37
Show Gist options
  • Save angelflo/dff15366bf2b979a9adb80c1718150ff to your computer and use it in GitHub Desktop.
Save angelflo/dff15366bf2b979a9adb80c1718150ff to your computer and use it in GitHub Desktop.
Auto Restart PHP5-FPM When Down or Bad Gateway
#!/bin/bash
if curl --head -sf http://yourdomain.com/some-script.php -o /dev/null; then
echo "PHP FPM is up"
else
service php5-fpm restart && service nginx restart && service mysql restart
echo "Opps .. service was down" | mail -s "PHP-FPM Service Down" [email protected] -aFrom:[email protected]
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment