且构网

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

如何捕获一个进程ID和当进程在一个bash脚本完成还添加了扳机?

更新时间:2022-06-22 04:23:40

您可以使用bash的UTIL 一旦你使用启动流程的nohup

You can use the bash util wait once you start the process using nohup

nohup java -jar jarfile.jar &
pid=$!     # Getting the process id of the last command executed

wait $pid  # Waits until the process mentioned by the pid is complete
echo "Done, execute the new command"