#!/bin/bash
while :
do
echo "Current DIR is " $PWD
stillRunning=$(ps -ef |grep "$PWD/oa.jar" |grep -v "grep")
if [ "$stillRunning" ] ; then
echo "TWS service was already started by another way"
echo "Kill it and then startup by this shell, other wise this shell will loop out this message annoyingly"
kill -9 $pidof $PWD/oa.jar
else
echo "TWS service was not started"
echo "Starting service ..."
$PWD/startup.sh
echo "TWS service was exited!"
fi
sleep 30
done