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 发布
本文介绍了一种在shell脚本中自动启动TWS服务,并在服务已由其他方式启动时,通过杀死进程来避免无限循环警告的方法。
1417

被折叠的 条评论
为什么被折叠?



