|
|
View valid 'top' output on the desktop via GeekTool
You're not actually shrinking the log file. Even though you're truncating it with the python script, the top process's stdout file-descriptor maintains its position in the log. Hence when top produces new output the beginning of the log is filled with null bytes. Try this test. Open two terminal windows. In the first terminal window, simulate your top process with:
View valid 'top' output on the desktop via GeekTool
> "You're not actually shrinking the log file."
Well, I may be wrong, but believe it or not I did check this :-) I suggest you check your theory on the given script and not on a different one. Here then is what you get if you watch the log's growth:
i.e. the size does shrink to zero once a minute. (You can also see this by opening the log in Console.app with a double click.) What you are describing is what would happen if I had used ">" in place of ">>" in the script's os.system line.
View valid 'top' output on the desktop via GeekTool
> "Now do an "od -a /tmp/foo" and notice the file is filled with nul bytes."
Not on my machine:
(I've done as you say in the other Terminal.) On the other hand, as I mentioned above, with ">" in place of ">>" you would get
I hope this clears it up! (I'd rather keep the 5-line script than switch to one that makes 25...)
|
SearchFrom our Sponsor...Latest Mountain Lion HintsWhat's New:HintsNo new hintsComments last 2 daysNo new commentsLinks last 2 weeksNo recent new linksWhat's New in the Forums?
Hints by TopicNews from Macworld
From Our Sponsors |
|
Copyright © 2014 IDG Consumer & SMB (Privacy Policy) Contact Us All trademarks and copyrights on this page are owned by their respective owners. |
Visit other IDG sites: |
|
|
|
Created this page in 0.09 seconds |
|