alv*_*vas 4 unix ssh remote-access nohup
我有一些关于 nohup 的问题。下面显示了我尝试过的命令和结果。如果我必须使用nohup ... &and then disown,那么 the 有什么用呢nohup?我可以简单地使用... &然后disown。
使用然后 ctr+c 运行命令nohup,该命令没有继续
$ nohup somecommand -option inputfile > outputfile
nohup: ignoring input and appending output to `nohup.out'
^C
Run Code Online (Sandbox Code Playgroud)
运行命令nohup ... &,然后按ctr+c,命令继续但退出后停止
$ nohup somecommand -option inputfile > outputfile &
nohup: ignoring input and appending output to `nohup.out'
^C
$ exit
Run Code Online (Sandbox Code Playgroud)
运行命令nohup ... &,然后按 ctr+c,即使退出后命令仍会继续
$ nohup somecommand -option inputfile > outputfile &
nohup: ignoring input and appending output to `nohup.out'
^C
$ disown
$ exit
Run Code Online (Sandbox Code Playgroud)
使用 without 运行命令nohup,然后按 ctr+c,即使退出后命令仍会继续
$ somecommand -option inputfile > outputfile &
nohup: ignoring input and appending output to `nohup.out'
^C
$ disown
$ exit
Run Code Online (Sandbox Code Playgroud)
如果我们保留stderr对终端的写入,则disown需要调用该函数来删除该作业或作业表中的所有作业。
因此,请确保您重定向stdout并且stderr都使用nohupand &:
nohup somecommand -option inputfile > outputfile 2>&1 &
exit
Run Code Online (Sandbox Code Playgroud)
命令仍将运行。
| 归档时间: |
|
| 查看次数: |
531 次 |
| 最近记录: |