且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

通过ssh将Java应用程序作为后台进程运行

更新时间:2021-12-17 03:48:04

移动&到行尾

#!/bin/sh
# this script starts a jar file and creates a shellscript which can be used to stop the execution.
nohup java -jar ~/storagenode.jar > ~/storagenode.log &
pId=$!
echo "kill $pId" > ~/stop_storagenode.sh
chmod u+x ~/stop_storagenode.sh