[英]nohup: ignoring input, but my python program DOES require input
train.py 是一個 python 程序,它使用 argparse 解析輸入變量,應該在沒有附加終端的情況下在后台運行,但總是忽略輸入。 我測試了以下選項:
/home/workspace# nohup /home/workspace/train.py vgg19 3000 1 cpu &
和
nohup /home/workspace/doit &
其中doit
是包含的腳本
/home/workspace/train.py vgg19 3000 1 cpu
這一切都導致:
home/workspace# nohup: ignoring input and appending output to 'nohup.out'
唯一可行的解決方法(我的項目還不能接受)是在 python 程序中對輸入變量進行硬編碼並使用:
nohup python -u./train_LONG.py &
此外,這非常令人困惑,即使是以下命令也會導致輸入被忽略:
nohup./train_LONG.py -u &
您誤解了錯誤消息的含義。 它涉及標准輸入,而不是命令行 arguments。
作為記錄,要運行需要使用nohup
讀取標准輸入的進程,請添加重定向。
nohup yourprogram <file &
或使用此處文檔
nohup yourprogram <<\HERE &
first line of input
second line of input
etc
HERE
或撥打 pipe
nohup printf '%s\n' "first line of input" "second line of input" etc |
yourprogram &
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.