Created
October 19, 2012 07:28
-
-
Save danish-rehman/3916721 to your computer and use it in GitHub Desktop.
Script watch
This file contains hidden or 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 | |
# find if Apache (httpd) running or not | |
service_list=('application_errormonitor.py' 'controller_errormonitor.py') | |
COUNTER=0 | |
for service in ${service_list[@]} | |
do | |
echo "----------------" | |
if ps ax | grep -v grep | grep $service > /dev/null; then | |
echo "$service service running, everything is fine" | |
else | |
echo "$service is not running" | |
if [ $COUNTER == 0 ]; then | |
nohup python /home/application_errormonitor.py & | |
elif [ $COUNTER == 1 ]; then | |
nohup python /home/controller_errormonitor.py & | |
fi | |
echo "$service started" | |
fi | |
echo "----------------" | |
let COUNTER=COUNTER+1 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment