nohup: ignoring input 要怎么应对
时间: 2023-02-21 22:26:51 浏览: 974
"nohup: ignoring input" 的错误信息是在提示你的脚本不再读取标准输入,这是因为你使用了 "nohup" 命令,该命令的作用是让后台运行的程序不再受到 HUP 信号的影响(HUP 信号通常用于终止后台运行的进程)。
如果你需要向脚本中传递输入,可以将输入重定向到文件中,然后再运行 "nohup" 命令。例如:
```
$ cat input.txt | ./script.sh > output.txt &
```
如果你不需要向脚本中传递输入,那么没有什么需要特别处理的,该错误信息可以忽略。
相关问题
nohup: ignoring input
nohup: ignoring input是nohup命令的一种提示信息,意味着该命令忽略了输入。
当在Linux中使用nohup命令时,如果不指定输入,nohup命令会自动忽略输入,并将输出记录到nohup.out文件中。
在默认情况下,nohup命令会在当前目录下生成一个名为nohup.out的文件来存储输出信息。如果当前目录的nohup.out文件不可写,则输出会被重定向到$HOME/nohup.out文件中。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [nohup: ignoring input and appending output to ‘nohup.out](https://blog.csdn.net/qq_51066068/article/details/124542326)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
- *2* *3* [nohup 命令之 nohup: ignoring input and appending output to ‘nohup.out’](https://blog.csdn.net/qq_45956730/article/details/124712224)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
nohup: ignoring input and redirecting stderr to stdout
nohup命令用于在后台运行程序,并将标准输出和标准错误输出重定向到指定文件。当启动服务时出现"nohup: ignoring input and redirecting stderr to stdout"的错误提示时,表示输入被忽略,并且标准错误输出被重定向到标准输出。
这个错误提示通常是由于命令行中使用了重定向符号">"和"2>",导致输入被忽略。要解决这个问题,可以尝试以下方法:
1. 检查命令行中的重定向符号是否正确使用,并确保没有多余的空格或特殊字符。
2. 确保命令行中的输入正确,并且没有被重定向到其他文件。
3. 如果需要将标准错误输出重定向到文件,可以使用以下命令:
```shell
nohup command > output.log 2>&1 &
```
这样可以将标准输出和标准错误输出都重定向到output.log文件中。
4. 如果需要实时查看输出,可以使用"-u"参数来禁用Python的输出缓冲,例如:
```shell
nohup python -u script.py > output.log 2>&1 &
```
这样可以实时将输出写入output.log文件中。