脚本监控进程运行

#!/bin/bash
while [ true ]
do

	pro=$(ps -ef | grep "testjar" | grep -v "grep" )
	if [ -z "$pro" ]
	then 
   		  echo "程序未启动,重新启动程序"
	         #启动jar包
	else
   		  echo "程序正在运行..."
	fi
	sleep 0.5
done

jar包可以使用软链接的方式启动,jps下就可以显示名称

猜你喜欢

转载自blog.csdn.net/zjx_z/article/details/85044230