Re: leading null characters produced in script...



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.
--
Robert HULL

Archival or publication of this article on any part of thisishull.net
is without consent and is in direct breach of the Data Protection Act
.



Relevant Pages

  • Re: leading null characters produced in script...
    ... In his case that will not work, since the program writing to the log ... If logrotate moves the log file to ... Certainly if he had a program which would allow its logs to be rotated tehn ...
    (comp.os.linux.misc)
  • 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: 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: Logrotate is a pain
    ... > I can't find any helpfull information/documentation about logrotate. ... when logrotate rotates the logfile of my java program it ... write to the syslog daemon rather than to a file. ... Alternatively, if your application writes to the log file infrequently, ...
    (comp.os.linux.misc)