|
Home > Archive > Web Servers on Unix and Linux > November 2005 > Nightly restart
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
|
|
| alstamp@gmail.com 2005-11-03, 7:48 am |
|
Hi folks
This question is about an apache 2.0.54 on a Debian Linux (sarge) box.
I need to build specific logs with one of our apache installs, and
rotate them at exactly midnight each night. I built a script to rotate
the log files, and added it to cron.
Then I noticed that apache was continuing to log to the file which was
rotated. This was because without a Hangup sent to apache, it would
hold the filehandle for the existing log open.
Therefore I need to restart apache immediately after the rotate. I
tried to change the crontab entry to this :
0 0 * * * /usr/local/bin/rotate.pl -f /var/log/apache2/access.log &&
chown logcheck /var/log/apache2/rotated-* && /etc/init.d/apache2
restart
The apache process stops, but does not start. Should I do something
more funky to guarantee a cleaner restart at midnight ?
BR
AS
| |
| Andy Davidson 2005-11-03, 7:49 am |
| [alstamp@gmail.com wrote in comp.infosystems.www.servers.unix]
> Therefore I need to restart apache immediately after the rotate. I
> tried to change the crontab entry to this :
> 0 0 * * * /usr/local/bin/rotate.pl -f /var/log/apache2/access.log &&
> chown logcheck /var/log/apache2/rotated-* && /etc/init.d/apache2
> restart
cronolog might be nicer, then you don't need to rotate. Perhaps it will
be too system-resource heavy, though ?
/usr/sbin/apache2ctl graceful might give a cleaner restart ?
Anyone here actually doing this rotation ?
cheers
-a
--
http://fotoserve.com/ -
Superb hand-checked AGFA prints, bright sharp posters,
strong block canvas prints, unique picture bags and gifts
..... from your own digital images.
| |
| Nick Kew 2005-11-03, 7:49 am |
| alstamp@gmail.com wrote:
> I need to build specific logs with one of our apache installs, and
> rotate them at exactly midnight each night.
Apache comes supplied with that capability. Use it instead of
reinventing the wheel, and you'll get a much smoother ride.
--
Nick Kew
| |
| alstamp@gmail.com 2005-11-03, 5:55 pm |
| Nick Kew wrote:
> alstamp@gmail.com wrote:
> Apache comes supplied with that capability. Use it instead of
> reinventing the wheel, and you'll get a much smoother ride.
Please could I beg some help - the name of the config variable that I
should google for perhaps?
BR
AS
|
|
|
|
|