Created
September 5, 2013 14:26
-
-
Save izmailoff/6450825 to your computer and use it in GitHub Desktop.
Quickly check web server services statuses: mongodb, tomcat, and apache/httpd.
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 | |
echo '*******************************************************************' | |
service httpd status; httpdStatus=$(echo $?) | |
service tomcat6 status; tomcatStatus=$(echo $?) | |
service mongod status; mongoStatus=$(echo $?) | |
echo '*******************************************************************' | |
if [[ $httpdStatus == 3 && $tomcatStatus == 3 && $mongoStatus == 3 ]]; then | |
echo "ALL SERVICES ARE STOPPED!" | |
else if [[ $httpdStatus == 0 && $tomcatStatus == 0 && $mongoStatus == 0 ]]; then | |
echo "ALL SERVICES ARE RUNNING!" | |
else | |
echo "SOME SERVICES ARE RUNNING!" | |
fi | |
fi | |
echo '*******************************************************************' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment