Created
August 8, 2011 17:25
-
-
Save skreutzberger/1132230 to your computer and use it in GitHub Desktop.
Keepalive of Nginx
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 | |
# shell script which checks if nginx is still running | |
# if not then it restarts the processes, including php-fpm | |
# this script should be called by a Cronjob every minute | |
# change the process name to whatever you want to keep alive: | |
PROCESS="nginx" | |
if ps ax | grep -v grep | grep $PROCESS > /dev/null | |
then | |
echo "$PROCESS is running" | |
else | |
echo "$PROCESS is NOT running" | |
# change the next line to the command you want to run for restarting: | |
sudo /etc/init.d/php5-fpm restart && sudo /etc/init.d/nginx restart | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment