shell脚本挟制进程重启

shell脚本强制进程重启while :doecho Current DIR is $PWDstillRunning$(ps -ef |grep $PWD/a.out |

shell脚本强制进程重启

while :doecho "Current DIR is " $PWDstillRunning=$(ps -ef |grep "$PWD/a.out" |grep -v "grep")if [ "$stillRunning" ] ; thenecho "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.outelseecho "TWS service was not started"echo "Starting service ..."$PWD/a.outecho "TWS service was exited!"fisleep 10done