Created
March 29, 2017 14:05
-
-
Save alkrauss48/d6e2aac92e6d7e68a8efaa134b1334de to your computer and use it in GitHub Desktop.
Restart 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
restart_nginx () { | |
# path to pgrep command | |
PGREP="/usr/bin/pgrep" | |
# Httpd daemon name, | |
HTTPD="nginx" | |
# find httpd pid | |
$PGREP ${HTTPD} | |
if [ $? -ne 0 ] # if nginx not running | |
then | |
# restart nginx | |
service nginx restart | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment