我有一个命令(程序),我想用nohup和后台运行它.喜欢
nohup command > logfile.txt &
我如何找出进程ID?我希望能够在文件中编写进程ID,稍后读取并以编程方式终止进程.
解决方法
在你的脚本中:
nohup command > logfile.txt & echo $! > /var/run/command.pid
我有一个命令(程序),我想用nohup和后台运行它.喜欢
nohup command > logfile.txt &
我如何找出进程ID?我希望能够在文件中编写进程ID,稍后读取并以编程方式终止进程.
在你的脚本中:
nohup command > logfile.txt & echo $! > /var/run/command.pid