Reputation: 35109
I have a python script that I run on a server with this command:
sudo nohup python fetch_script.py &
It creates a nohup.out
file on the same directory.
After a few days I came back and tried to check it, I did:
tail -f nohup.out
It gave me a result:
root@xx-xxx-xxx-xx:/home/ubuntu# tail -f nohup.out
8809896
8809897
8809898
8809899
8809900
8809901
8809902
8809903
8809904
8809905
I waited a little bit but nothing happend. The script supposed to send messages to the RabbitMQ and update count and print it. The script was running the whole time, I know for sure, because I could see new messages where coming constantly. But nohup.out
stuck. I also checked it with ls -l
command to see if the size changed, but still no luck.
Do you know what could be the reason for that? I assume that it will be eventually updated but don't know how long it would take. So are there any ways to constantly update this file? Will nice -20
help in this case?
Just rotate the Log, with /usr/sbin/logrotate
waited a bit and saw changes in fresh nohup.out
Upvotes: 2
Views: 4531
Reputation: 111239
The nohup.out
file is written directly by the program that is being run under nohup
, just like with normal shell redirection. If it's not being updated the problem is with the Python program, not with nohup
itself.
Upvotes: 4