nohup as background task does NOT return prompt

Chris Muench picture Chris Muench · Apr 12, 2014 · Viewed 15.5k times · Source

I am trying to run a long running task in the background without having to be logged in and have the terminal return a prompt, but when I do this, the task appears to go into the background, but my prompt does not become available unless I hit control + c. I want to run the task and then get my prompt back.

[staging@php-pos-web ~]$ nohup php test.php > test.txt &
[1] 27251
[staging@php-pos-web ~]$ nohup: ignoring input and redirecting stderr to stdout

Answer

Devon picture Devon · Apr 12, 2014

You should have your prompt available because your command will be sent to the background. It is possible that you are not seeing your prompt because your command is still delivering stderr messages to your console. Try using > test.txt 2>&1 </dev/null &.