首页 > 其他 > 详细

nohup和&

时间:2019-08-01 13:30:26      阅读:48      评论:0      收藏:0      [点我收藏+]

nohup,不挂断地运行命令。

nohup运行由 Command参数和任何相关的 Arg参数指定的命令,忽略所有挂断(SIGHUP)信号;

用法: 

nohup COMMAND [ARG]...
or: nohup OPTION                         

 忽略所有挂断(SIGHUP)信号

--help 

--version 

If standard input is a terminal, redirect it from /dev/null.
If standard output is a terminal, append output to `nohup.out‘ if possible,
`$HOME/nohup.out‘ otherwise.
If standard error is a terminal, redirect it to standard output.
To save output to FILE, use `nohup COMMAND > FILE‘.

 0 – stdin (standard input),1 – stdout (standard output),2 – stderr (standard error) ;

 

: 指在后台运行

nohup : 不挂断的运行,注意并没有后台运行的功能,,就是指,用nohup运行命令可以使命令永久的执行下去,和用户终端没有关系,例如我们断开SSH连接都不会影响他的运行,注意了nohup没有后台运行的意思;&才是后台运行

&是指在后台运行,但当用户推出(挂起)的时候,命令自动也跟着退出

那么,我们可以巧妙的吧他们结合起来用就是
nohup COMMAND &
这样就能使命令永久的在后台执行
 
 
 
 

nohup和&

原文:https://www.cnblogs.com/zhco/p/11281682.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!