Forum Moderators: phranque

Message Too Old, No Replies

Starting a script in cron.daily before logrotate

         

maggi

10:14 am on Aug 7, 2004 (gmt 0)

10+ Year Member



I want to start a script "calclog" to analyse access_log at the end of the logging period just before logrotate starts the next day.
I tried a name for that bash script as aaa_calclog in order to get that script started before logrotate.
It worked once and send me a mail at 3.15 and delivered a calculation from the day, but on 2 days when starting at 00.15 there was nothing, or only a period of 1 hour analysed.
Question:
Where is the time defined for cron.daily?
Is it exactly each day the same time?
Are the files in the subdirectory cron.daily sequently processed in alfabetical order?
How may I use cron.daily to secure the execution of script aaa before logrotate?
Or do I have to control the execution with a specific entry into cron?
Thanks a lot, Maggy

lemat

1:10 pm on Aug 8, 2004 (gmt 0)

10+ Year Member



Here is my /etc/logrotate.d/httpd:

/var/log/httpd/*log {
rotate 150
weekly
missingok
notifempty
sharedscripts
compress
prerotate
grep -E "(cmd¦root)\.exe" /var/log/httpd/access_log¦cut -d " " -f 1,4¦tac¦sort -u -k 1,1 >> /var/log/usage/nimda.txt
grep "default.ida" /var/log/httpd/access_log¦cut -d " " -f 1,4¦tac¦sort -u -k 1,1 >> /var/log/usage/codered.txt
grep "CONNECT" /var/log/httpd/access_log¦cut -d " " -f 1,4¦tac¦sort -u -k 1,1 >> /var/log/usage/proxies.txt
endscript
postrotate
apachectl graceful
endscript
}

as you see you can add anything you want just before logrotate.
if you still want to add a script to cron.daily see /etc/crontab

(of course the above are for MY system - your linux may be configured in differrent way)