簡體   English   中英

使用多個命令行參數運行nohup並重定向stdin

[英]Run nohup with multiple command-line arguments and redirect stdin

我要跑步

python argument1.txt argument2.txt >logfile.log

使用nohup,但沒有輸出,因為它將輸入重定向到null。 我希望它首先接受命令行參數並以nohup方式工作。

nohup python argument1.txt argument2.txt >logfile.log

當我運行上面的命令時,我得到以下輸出。 nohup:忽略輸入和追加...,這意味着將忽略參數。 在手冊上說我必須做一些輸入重定向,我不知道該怎么做。

nohup重定向到nohup.out

如果您希望獲得nohup外觀並重定向到另一個文件,請執行以下操作:

( python argument1.txt argument2.txt >logfile.log 2>logfile.err & ) &

注銷時不會掛斷。 (您可以通過將2>logfile.err替換為2>&1將stderr重定向到同一日志文件

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM