Perhaps "logrotate" can help you here.

>From the manpage:

logrotate  is  designed to ease administration of systems that generate
large numbers of log files.  It allows automatic rotation, compression,
removal, and mailing of log files.  Each log file may be handled daily,
weekly, monthly, or when it grows too large.



- Chan Kok Leong




John McKown <joa...@swbell.net>
Sent by: Linux on 390 Port <LINUX-390@VM.MARIST.EDU>
01/07/2009 05:50 AM
Please respond to
Linux on 390 Port <LINUX-390@VM.MARIST.EDU>


To
LINUX-390@VM.MARIST.EDU
cc

Subject
bash shell question






I've got a small problem. I have a daemon which I cannot easily restart
because it is production and people are using it. The daemon is started
with something like:

daemon args >>daemon.log

The file "daemon.log" is getting very huge. The correct way to fix this is
to stop the daemon, "mv" or "rm" the "daemon.log", then restart the
daemon. But I have a vague memory that it is sometimes possible to "reset"
a file to "empty" simply by doing a:

>daemon.log

and that will, at times, work even if the daemon is not restarted. Is my
memory correct? Or is that some sort of "special case" which does not
apply when bash does a >> redirect of stdin?

We plan to fix this by "not doing that!", but instead piping the stdout
from the daemon to a process called "cronolog" which works by
automatically changing the output file at midnight by changing the "date
portion" of the log name.

--
Q: What do theoretical physicists drink beer from?
A: Ein Stein.

Maranatha!
John McKown

----------------------------------------------------------------------
For LINUX-390 subscribe / signoff / archive access instructions,
send email to lists...@vm.marist.edu with the message: INFO LINUX-390 or
visit
http://www.marist.edu/htbin/wlvindex?LINUX-390


----------------------------------------------------------------------
For LINUX-390 subscribe / signoff / archive access instructions,
send email to lists...@vm.marist.edu with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390

Reply via email to