#!/bin/bash
ps -ef |grep "java -jar" > /apps/appcheck
x=$(cat /apps/appcheck |grep "TestApp.jar" |wc -l)
echo $x
if [ $x = 0 ]
then
date
echo ""
echo "starting... check logs "
cd /apps/sujith/test
nohup java -jar -Xms128m -Xmx256m TestApp.jar 2 >> TestApp.log &
elif [ $x = 1 ]
date
echo ""
echo "starting... check logs "
cd /apps/sujith/test
nohup java -jar -Xms128m -Xmx256m TestApp.jar 2 >> TestApp.log &
elif [ $x = 1 ]
then
date
echo "stopping..."
cat /apps/appcheck|grep "TestApp.jar" | awk -F " " '{print $2}' | xargs kill -9
echo "stopped"
date
echo "starting..."
cd /apps/sujith/test
nohup java -jar -Xms128m -Xmx256m ThripleNine.jar 2>> TestApp.log &
else
echo "error occurred. check."
fi
No comments:
Post a Comment