[Chicago-talk] Is this efficient.

Warren Smith warren at warrenandrachel.com
Tue Oct 4 10:04:11 PDT 2005

I may have misunderstood the problem, but perl -i edits a file in place 
by doing all the move magic for you.

Richard Reina wrote:

>This program puts caller id info into a the text file
>each time a call come through only for viewing
>purposes for users (employees) at there individual
>workstations.  The data is not critical and we only
>want to keep the last few hundred calls in the file. 
>More complete data is on the PBX Server, so this file
>is not critical. 
>--- Pete Krawczyk <mongers at bsod.net> wrote:
>>Subject: [Chicago-talk] Is this efficient.
>>From: Richard Reina <richard at rushlogistics.com>
>>Date: Tue, 4 Oct 2005 09:41:20 -0700 (PDT)
>>}system("perl -ni.bak -e 'print unless 1..1'
>>Holy Race Condition, Batman!  Never mind the system
>>call, this is a recipe 
>>for disaster as written.  You run the risk of new
>>data being written at 
>>the wrong time or total loss of data if two of these
>>run at the same time.
>>I would highly, highly, highly suggest either using
>>a log rotation tool 
>>(such as logrotate) or a manual process to move the
>>Is there any particular reason you need a cyclical
>>log file instead of 
>>one that grows?
>>-Pete K
>>Pete Krawczyk
>>  perl at bsod dot net
>>Chicago-talk mailing list
>>Chicago-talk at pm.org
>A people that values its privileges above its principles soon loses both.
> -Dwight D. Eisenhower.
>Chicago-talk mailing list
>Chicago-talk at pm.org

More information about the Chicago-talk mailing list