CentOS下nohup命令

nohup命令:由 Command参数和任何相关的 Arg参数指定的命令,忽略所有挂断SIGHUP信号。
如果不将 nohup 命令的输出重定向,输出将附加到当前目录的 nohup.out 文件中。如果当前目录的 nohup.out 文件不可写,输出重定向到 $HOME/nohup.out 文件中。

语法:nohup Command [ Arg … ] [ & ]
用途:不挂断地运行命令

nohup
&命令:后台运行
一般可在nohup结尾加上*&*将命令同时放入后台运行,也可用 >filename 2>&1 来更改缺省的重定向文件名。
nohup ./myfirst.sh >> /home/cent/Desktop/output.log 2>&1 &

nohup
Kill终止命令
jobs -l 显示所有job
kill 或 kill -9 终止进程;一般情况下,-9可以马上杀死进程,没有任何阻塞

猜你喜欢

转载自blog.csdn.net/weixin_44153121/article/details/86594116