[Chicago-talk] Is this efficient.

Pete Krawczyk mongers at bsod.net
Tue Oct 4 09:54:44 PDT 2005

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' text.txt");

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 files.

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

More information about the Chicago-talk mailing list