nohup does not work properly nohup does not work properly unix unix

nohup does not work properly


You could use screen :

screen -L ./test.sh

You can use Ctrl-A and d to detach the screen.

You can log out without killing test.sh

You can log back, and type

screen -r

to come back to your script.

Stdout will be logged to screenlog.0


I think you might have already figured out the root cause and a working solution.

But I am writing this answer so that it will be helpful to someone else.

This might be the root cause.

Still there is no guarantee in consistency of nohup (mentioned at the end of given answer).

Other commands to do the same thing.

  1. spawning subshells with parenthesis.

    (./test.sh > test.log &)

  2. disown in conjunction with the backgrounding ampersand.

    ./test.sh > test.log & disown