Created
February 14, 2017 06:18
-
-
Save coffeesam/bddae7aeb12107a5e2cc010725b8d1eb to your computer and use it in GitHub Desktop.
Nginx configuration reload script
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
#!/usr/bin/env bash | |
echo | |
echo Checking Nginx config file... | |
ERR_MSG=$((sudo nginx -t) 2>&1) | |
if [ $? -eq 0 ]; then | |
echo -e "Nginx configuration file test : \e[32mPASSED\e[39m" | |
sudo nginx -s reload | |
if [ $? -eq 0 ]; then | |
echo Nginx configuration reloaded. | |
else | |
echo Nginx not reloaded. Please check your config file. | |
fi | |
else | |
echo -e "Nginx configuration file test : \e[31mFAILED\e[39m" | |
echo -e $ERR_MSG | |
fi | |
echo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment