nohup 命令之 nohup: ignoring input and appending output to ‘nohup.out’

当我在linux中使用nohup 命令的时候,出现了这个错误:

nohup: ignoring input and appending output to ‘nohup.out’
忽略输入输出,将信息化信息记录到nohup.out文件中。

补充:nohup 命令

nohup 英文全称 no hang up(不挂起),用于在系统后台不挂断地运行命令,退出终端不会影响程序的运行。

nohup 命令,在默认情况下(非重定向时),会输出一个名叫 nohup.out 的文件到当前目录下,如果当前目录的 nohup.out 文件不可写,输出重定向到 $HOME/nohup.out 文件中。

1、用途:LINUX命令用法,不挂断地运行命令。

2、语法:nohup Command [ Arg ... ] [&]

3、描述:nohup 命令运行由 Command 参数和任何相关的 Arg 参数指定的命令,忽略所有挂断信号。

4、在注销后使用 nohup 命令运行后台中的程序。要运行后台中的 nohup 命令,添加 &到命令的尾部。

使用格式:

 nohup Command [ Arg … ] [ & ]

举例:

比如,我们输入这个nohup命令:

nohup /root/runoob.sh &

如果在终端看到下面所示的输出说明的话,就说明该nohup命令运行成功了:

appending output to nohup.out

那么现在当我们打开 root 目录的时候,我们就可以看到生成了一个 nohup.out 文件。 

出现原因:

Linux下如果我们想让某个程序在后台运行,可以使用 & 在程序结尾来让程序自动运行。

出现这个错误的原因:说明你在运行后台中的 nohup 命令的时候,没有添加 &到命令的尾部

解决方法:

在想要运行在后台中的 nohup 命令的尾部,添加 &,就不会报错了。

猜你喜欢

转载自blog.csdn.net/qq_45956730/article/details/124712224