Re: leading null characters produced in script...



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.


--
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: 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)
  • Re: Logrotate is a pain
    ... >> I'm using logrotate to backup my apache log files and a custom log ... when logrotate rotates the logfile of my java program it ... > seems to be that your application opens a file and keeps writing to it. ... > Alternatively, if your application writes to the log file infrequently, ...
    (comp.os.linux.misc)
  • Re: Logrotate is a pain
    ... logrotate script, would signal that logging program to tell it to close ... Tell logrotate to signal or restart it. ... and reopen the log file on signal or restart. ... By the same mechanism - signalling it, ...
    (comp.os.linux.misc)
  • Re: Renaming an open file
    ... > rotated using the logrotate utility. ... > - myprog writes to the log file ... will not see any data added to 'mylog' until you explicitly close your ...
    (comp.unix.programmer)
  • Re: logrotate and perl file handles. How do I know when to reopen my log file?
    ... I'm not monitoring the log file, I'm writing to it. ... logrotate and perl file handles. ...
    (perl.beginners)