Re: leading null characters produced in script...



Robert Hull <Robert@xxxxxxxxxxxxxxxxxxxxxxxx> writes:

On Monday 30 October 2006 20:51, Unruh <unruh-spam@xxxxxxxxxxxxxx> wrote
in comp.os.linux.misc:

Robert Hull <Robert@xxxxxxxxxxxxxxxxxxxxxxxx> writes:

On Monday 30 October 2006 06:54, Avalon1178 <Avalon1178@xxxxxxx> wrote
in comp.os.linux.misc:

I'm trying to write a small script using bash that essentially
archives logs to prevent logs from getting too big and take up drive
space.
man logrotate

In his case that will not work, since the program writing to the log
file has the file open (via redirection) and two programs writing to a
log file is not a good idea. If logrotate moves the log file to
logfile.1, the program will continue writing to logfile.1 since it is
writing the inode which has not changed.

In order to allow log file rotation, he has to rewrite the program
writing to the log file so that it can allow the log file to be moved.

Since logrotate already has much of the functionality that the OP
appeared to be suggesting (s)he wanted, I thought (s)he might be able
to learn from a program that already does it.

Certainly if he had a program which would allow its logs to be rotated tehn
logrotate would be the thing to use. However, his program is not of the
form that allow the logs to be rotated since he keeps the file open.


.



Relevant Pages

  • Re: leading null characters produced in script...
    ... archives logs to prevent logs from getting too big and take up drive ... In his case that will not work, since the program writing to the log ... If logrotate moves the log file to ...
    (comp.os.linux.misc)
  • Re: Multi-Threading
    ... 100,000+ line log file and decided to use multi-threading as a solution to ... Multi-threading on the desktop is useful when you're executing long running ... getting the info is a problem or is writing it the database, ... Do Until intcount> intcount1 ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Set Trace to Ignore Errors in Trace.WriteLine?
    ... opened and locked - other processes should not be able to lock ... The problem appears to be something reading the log file not writing to it. ... Microsoft Online Community Support ...
    (microsoft.public.dotnet.languages.vb)
  • Re: safely close file that may be written to
    ... I can't be certain that procmail won't be ... writing to it at the time I move it. ... If what you want, however, is to *change* the name of the log file so ... logrotate just moves the file -- entirely safe. ...
    (uk.comp.os.linux)
  • Re: Hard Drive Space
    ... of the distribution, ... security problems it had over the life of the distribution. ... in the space, either the box is 0wn3d, or you have a process that is writing ... If you don't recall removing some log file manually, ...
    (linux.redhat)