while :
do
echo "Current DIR is " $PWD
stillRunning=$(ps -ef |grep "$PWD/a.out" |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/a.out
else
echo "TWS service was not started"
echo "Starting service ..."
$PWD/a.out
echo "TWS service was exited!"
fi
sleep 10
done
shell脚本强制进程重启
最新推荐文章于 2023-06-28 16:56:39 发布