I have a ruby script that writes to STDOUT and sometimes STDERR. I am running this script every 5 minutes via a crontab:
*/5 * * * * /root/myscript.rb >> /var/log/myscript.log 2>&1
What I've noticed is that the log file will not be written to in real time. Instead, it waits until the script has exited, and then all at once writes to that log file. I feel like I have other scripts that do not have this behavior, but perhaps I am mistaken.
Is this just how it works? Is there something I should look for to change this behavior?
This is Ubuntu 12.04