Skip to content

Instantly share code, notes, and snippets.

@Igcorreia
Forked from fer-ri/restart-service.sh
Created March 17, 2021 19:12
Show Gist options
  • Save Igcorreia/6d03dc3bf0ffe998fe8fe87b227b69a1 to your computer and use it in GitHub Desktop.
Save Igcorreia/6d03dc3bf0ffe998fe8fe87b227b69a1 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