[IRCServices] Rotate Log function - performance
Orion
orion at tribble.dyndns.org
Sat Mar 3 04:12:01 PST 2001
Ian R. Justman said:
> As has been suggested, use SIGUSR2. Then let Cron deal with the "per
> second" dickering to call a Perl/Python/Script/whatever script you may
> write deal with the actual rotating.
>
> As for precision, does the phrase, "Measure with a micrometer, mark with
> chalk, cut with an axe" mean anything to you? I don't know about you, but
> I frankly don't much care. Just as long as I can move logs out of the way
> and keep my disk space somewhat manageable, that's all I ask.
>
> I was the one who asked for this function. Mainly because it's MUCH
> easier to set up a cron event than to try to remember to get my butt onto
> IRC and issue the rotatelog command.
>
> In fact, many systems use this kind functionality notably with system
> logs, including most Linux distros as well as FreeBSD and possibly the
> other BSDs as well. I figured something like this should be in Services
> because the operating system already has tools which allow for periodic
> scheduling; wny not use them? ;) Plus it's pretty simple to whip up a
> rotating script in Perl or even shell script.
or just add a stanza to your logrotate.conf :)
/usr/local/lib/services/services.log {
daily # or 'weekly' if you prefer :)
rotate 14 # save 14 backups of logs
errors root # mail errors to root
compress # compress old logs
create 0600 user group # create an empty logfile with these permissions
# after rotating the old one out of the way
postrotate # execute these commands after rotating the logfiles
kill -SIGUSR2 `cat /usr/local/lib/services/services.pid`
endscript
}
Disclaimer: I haven't actually tried that. just whipped it up on the fly... still
using old services myself ;)
--
Orion orion [at] tribble [dot] dyndns [dot] org
Happiness isn't happiness
without a violin-playing goat