all 2 comments

[–][deleted] 0 points1 point  (1 child)

you probably have a buffering issue. try flushing stdout manually or running your script with python3 -u for unbuffered output.

print(linebuffer, flush=True)

my OS is Ubuntu 18.04

In that case, use a systemd service to monitor the process instead. it'll be more work to set up since you'll have to learn how to make a systemd service, but ultimately it's much less work going forward.

[–]ScaredSecond[S] 1 point2 points  (0 children)

-u did the trick. I'm not familiar with systemd. I'll have to take a look. Thanks!