On Dec 18, 2009, at 8:08 PM, Brandon Allbery wrote:

On Dec 18, 2009, at 23:02 , Scott Haneda wrote:
# make a copy of the file and also clear it cd /path/to/ cat running_log > stale_log && echo "" > running_log


mv running_log running_log.old && touch running_log && cat running_log.old >stale.log

Mind breaking that out for me?
If running_log is basically a live copy of another log, always being written to, and a mv (rename) it, I assume that running_log.old still gets written to? The OS keeps writing my tail command to it, even though the name has changed?

Then the double && which seems a AND operator to me, never seen it in this use case before. Next up, you crate a file running_log, which will be empty, and shove the running_log.old contents into the stale.log. I think I need to rm running_log.old as well?

But this all depends on the tail command continuing to write to a log file even though it has been renamed. I assume this is near always the case, which is why I generally have to sleep apache on a log roll, and let those last open connections clean themselves up?

I will do a few little tests, thanks for the pointers.
--
Scott * If you contact me off list replace talklists@ with scott@ *

_______________________________________________
macports-users mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macports-users

Reply via email to