美文网首页
Linux|命令后台运行

Linux|命令后台运行

作者: Woooooooooooooo | 来源:发表于2020-03-31 17:27 被阅读0次

nohup 命令 > run.log 2>&1 &

1:standard output

2:standard error

2>&1:报错重新定向到标准输出,在输出到run.log文件

&:在后台运行

&与nohup差别

&指后台运行,ctrl+c不会影响程序运行,但是关闭shell产生的挂起信号会使程序中断。nohup可以忽略因关闭shell产生的挂起信号,但是ctrl+c会使程序中断。

查看后台程序:ps(可查看pid)

结束进程:kill PID

相关文章

网友评论

      本文标题:Linux|命令后台运行

      本文链接:https://www.haomeiwen.com/subject/hvcguhtx.html