jar 包启动自动脚本

#!/bin/sh
source /etc/profile
source /root/.bash_profile
workdir=$(cd $(dirname $0); pwd)

jarname=im-1.0-SNAPSHOT.jar

echo "${jarname} start..."

ps -ef | grep ${jarname} | grep -v grep
if [ $? -ne 0 ]
then
echo "start ${jarname} process....."
cd $workdir
java -jar ${jarname} >> ./logs/start.log 2>&1 &
else
echo "${jarname} runing....."
fi

你可能感兴趣的:(jar 包启动自动脚本)