On Dec 19, 2009, at 03:31 , Scott Haneda wrote:
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?

Hm. Think I got confused; the above is intended for the initial program's log, not your running log. (I would think your tail command would become confused when the program's log is rewritten as you said it was.)

Then the double && which seems a AND operator to me, never seen it in this use case before.

"do the next thing only if the previous one succeeded", always a good idea when the alternative is data loss.

--
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] [email protected]
system administrator [openafs,heimdal,too many hats] [email protected]
electrical and computer engineering, carnegie mellon university    KF8NH



Attachment: PGP.sig
Description: This is a digitally signed message part

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

Reply via email to