I'm trying to run a ruby script with nohup
:
nohup ruby script.rb &
This takes hours to run, but logs its progress via puts
.
Usually, I can look at nohup.out to view the recent output of anything I run with nohup. However, my ruby script doesn't seem to output anything until it finishes, or is killed.
What am I doing wrong?
I'm not familiar with running commands through
nohup
, but approaching this from a "I'm outputting content to a file and it's only being written after the script exits" type of problem, those are caused by the output being buffered.So it's very likely that being run through
nohup
(and thus redirecting theputs
output to nohup.out) you lost synchronization. You might need toflush
occasionally or enablesync
. Sinceputs
is "equivalent to$stdout.puts
":