On 16-Mar-98 Montana Banana wrote:
> In my /etc/logrotate.d/apache file, the following line accompanies the
> entry for each of the virtual domains on my server:
> postrotate
> /usr/bin/killall -HUP httpd
> endscript
>
> Is it necessary to kill/restart the apache daemon after *each* log file
> is rotated. My server not only has numerous domains hosted on it, but
> also for each domain, there are multiple log files (errorlog, accesslog,
> referrerlog, etc.). So, whenever logrotate executes the
> /etc/logrotate.d/apache file, the daemon is restarted over a 100 times!
> This seams silly/inefficient to me.
It doesn't kill your web server then restart it. The kill command is used to
send signals to a process, and the most common one is to stop the process.
The -HUP indicates to send a -1 signal to the process. You might be familiar
with 'kill -9' which indicates to send a SIGKILL signal, vs the -1, which is
SIGHUP.
Try typing 'kill -l' to get a list of the accepted signals you can send to a
process. All but the KILL signal is capable of being handled by the process,
and in apache's case, it handles SIGHUP by re-reading its configuration files.
> Can I simply run a single "killall -HUP httpd" command after I have
> rotated *all* my files, as opposed to restarting the daemon after *each*
> file?
Yes, you can still do this if you want to, but don't bother. One day you may
rearrange how the files are rotated, and you'll end up with logs that don't
get rotated at all..
Again, the web server is never stopped and restarted.
> PS Bonus question: how can I tell logrotate to mail me compressed
> versions of my log files instead of the raw ones? I know how to
> compress the old files as they are stored, and I know how to mail the
> uncompressed log files to me, but I do not know how to compress and then
> mail.
Download the code, and find the line that does the mailing, and change it.
The code is only a few hundred lines long, and it should be easy to change.
You can grep for, exactly:
sprintf(command, "/bin/mail"
which is what I just found in the code. You should run uuencode on your data
before mailing it, though.
Can't you find a better way to retrieve your log files? Are you trying to
transfer them from one system to another? Use ssh for this.
Dave
--
PLEASE read the Red Hat FAQ, Tips, Errata and the MAILING LIST ARCHIVES!
http://www.redhat.com/RedHat-FAQ /RedHat-Errata /RedHat-Tips /mailing-lists
To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject.