Skip to content

Instantly share code, notes, and snippets.

@izmailoff
Created September 5, 2013 14:26
Show Gist options
  • Save izmailoff/6450825 to your computer and use it in GitHub Desktop.
Save izmailoff/6450825 to your computer and use it in GitHub Desktop.
Quickly check web server services statuses: mongodb, tomcat, and apache/httpd.
#!/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