Issue
train.py is a python program that parses the input variables using argparse, and should run in the background without an attached terminal, but invariably the input is ignored. I tested the following options:
/home/workspace# nohup /home/workspace/train.py vgg19 3000 1 cpu &
and
nohup /home/workspace/doit &
where doit
is a script containing
/home/workspace/train.py vgg19 3000 1 cpu
which all result in:
home/workspace# nohup: ignoring input and appending output to 'nohup.out'
The only workaround that works (yet not acceptable for my project) is to hard-code the input variables in the python program and use :
nohup python -u ./train_LONG.py &
Moreover, which is super confusing, even the following command results in input being ignored:
nohup ./train_LONG.py -u &
Solution
You are mistaken about what the error message means. It relates to standard input, not command-line arguments.
For the record, to run a process which needs to read standard input with nohup
, add a redirection.
nohup yourprogram <file &
or with a here document
nohup yourprogram <<\HERE &
first line of input
second line of input
etc
HERE
or with a pipe
nohup printf '%s\n' "first line of input" "second line of input" etc |
yourprogram &
Answered By - tripleee