手动输入一些命令,启动任务会很麻烦。可以写个start.sh脚本,去执行。
以下bin/bish,和bin/sh,都可以,但是bish可以支持 ./**启动。
#!bin/sh pid=`ps -ef|grep -v grep|grep ****-1.0-SNAPSHOT.jar|awk '{print $2}'` echo $pid kill -9 $pid echo > nohup.out nohup java -jar ***-1.0-SNAPSHOT.jar --server.port=8080 &
------
-------------------------- #!bin/bash appname=*****.jar pid=`ps -ef|grep -v grep|grep ${appname}|awk '{print $2}'` echo $pid if [[ x$pid == x ]] then kill -9 $pid sleep 5 fi echo start--- nohup java -DLOG_HOME=applogs -jar $appname --server.port=8083 --spring.profiles.active=release > /dev/null 2>&1 &