linux_java_启动一个项目脚本

test.sh

-------------------------------------------------------------------------------------------------------------

#!/bin/sh
while :
do
run1=$(ps -ef |grep 'sxnx-sms-8081' |grep -v "grep")
if [ "$run1" ] ; then
echo "The sxnx-sms-8081 service is alive!"
else
echo "The sxnx-sms service was shutdown!"
echo "Starting service sxnx-sms-8081..."
nohup java -jar $PWD/sxnx-sms-8081.jar&
echo "The service sxnx-sms-8081 was started!"
fi
sleep 10
done

原文地址:https://www.cnblogs.com/curedfisher/p/13039877.html