#!/bin/bash
ps -ef |grep "java -jar" > /apps/sujith/apps
x=$(cat /apps/sujith/apps |grep "SMS_App.jar" |wc -l)
echo $x
if [ $x = 0 ]
then
date
echo " Starting ......Please check logs !! "
echo ""
cd /apps/sujith/sms
nohup java -jar -Xms32m -Xmx128m SMS_App.jar 2>> SMS_App.err &
elif [ $x = 1 ]
then
date
echo "STOPPING "
cat /apps/sujith/apps |grep "SMS_App.jar" | awk -F " " '{print $2}' | xargs kill -9
echo "STOPPED "
date
echo "STARTING"
cd /apps/sujith/sms
nohup java -jar -Xms32m -Xmx128m SMS_App.jar 2>>SMS_App.err &
else
echo "SMS App"
fi
No comments:
Post a Comment