Skip to content

Instantly share code, notes, and snippets.

@alkrauss48
Created March 29, 2017 14:05
Show Gist options
  • Save alkrauss48/d6e2aac92e6d7e68a8efaa134b1334de to your computer and use it in GitHub Desktop.
Save alkrauss48/d6e2aac92e6d7e68a8efaa134b1334de to your computer and use it in GitHub Desktop.
Restart Nginx
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