I need to run some python scripts with infinite loop on ubuntu server (Amazon EC2). And I really like the idea to use nohup as it is simple and I can have output.out log file. I start script like

nohup script.py > output.out & 

The process get started. I check it with jobs -l all fine. Then I close the terminal and log back check processes with jobs -l and I can't see it any more. Can you advise me what am I doing wrong?


If you change session (log out and come back), there is no chance you'll see your script as job.

try ps instead.

ps -u myuser

replacing myuser with actual login..

| improve this answer | |

If your job is visible when you use jobs -l you can remove it from your session with disown

Another way to keep script running is to use the screen tool.

| improve this answer | |

Try redirecting all I/O streams

nohup script.py < /dev/null > output.out 2> error.out &
| improve this answer | |

Long expalation:
Background running process (job) is always bound to particular terminal:

[11]user@lab7-11:~> nohup ./test.sh > out &
[1] 39978

[11]user@lab7-11:~> ps aux |grep 39978
user   39978  0.0  0.0 106096  1156 pts/11   S    06:15   0:00 bash ./test.sh

While it is bound to terminal, you are able to see it in jobs output:

[11]user@lab7-11:~> jobs -l
[1]+ 39978 Running                 nohup ./test.sh > out &

After you've closed that terminal, your job became daemon and is not more bound to terminal

[7]user@lab7-11:~> ps aux |grep 39978
user   39978  0.0  0.0 106096  1156 ?        S    06:15   0:00 bash ./test.sh

So, at this stage, you can check state of your process via ps as suggested by @Archemar but not via job

Short explanation: Your script was not killed - it became daemon.

| improve this answer | |
  • Thanks. With ps I can see that process is still running. Thanks a lot – Arthur Zangiev Feb 16 '16 at 14:49
  • If this helped, you can accept this as answer :) – user1700494 Feb 16 '16 at 14:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.