I executed a python code in the AWS Lightsail linux server in the background It contains 5M Records insertions and I added logs after every insertion. I don’t see log output after 852.
I Can see my process is still running the background
If I delete the nohup.out file will it recreate the file with new Logs? How can I see the actual logs of the python code ?
Advertisement
Answer
I assume you started your program using nohup
like this:
nohup your_program maybe some arguments &
The nohup
command will redirect the output to nohup.out
before starting your program. Your program does not know that the output is redirected. That’s why you cannot make it recreate the output file nohup.out
.
If you remove nohup.out
you will only remove the directory entry. The file will still exist as an inode on your disk with all the data until your program terminates (or closes stdout
and stderr
), but you can no longer access the file by its name.
If you don’t see any new output, then your program doesn’t produce any. Note that the output is probably buffered, so it will appear in the file only when the program has written a certain amount of data. You have to check what your program is doing. It might be blocked somehow or you might have a bug in your program.
Maybe you can use strace
to check what system calls are done by your program.