I was watching a log file (logfile.log) with tail -f
, and after a few minutes, the following message was written to the file:
tail: logfile.log: file truncated
I've never seen that before and I'm wonder why it happened, and how I can prevent it. The file is being written to by root (via a cronjob), and was created by another user.
It also seems that the cronjob is actually overwriting the logfile each time. I guess that this is probably the reason for the message I was seeing.
Edit Here's what the cronjob looks like:
* * * * * /usr/local/bin/ruby /home/web/script.rb > >/home/web/logfile.log 2>&1
*.log
file on the system?) Besides, our servers are in PST...../script.rb >>/home/web/logfile.log
for it to propertly append? Your code seems to have a space between the double angle brackettail -F
instead oftail -f