logrotate of Asterisk log at midnight
I am trying to do log rotation on my Asterisk log.
I put the following script in /etc/logrotate.d:
/var/log/asterisk/messages /var/log/asterisk/*log
{
daily
missingok
rotate 90
create 0640 asterisk asterisk
sharedscripts
postrotate
/usr/sbin/asterisk -rx "logger reload" > /dev/null 2> /dev/null
endscript
}
/var/log/asterisk/cdr-csv/Master.csv
{
daily
missingok
rotate 365
create 0640 asterisk asterisk
This script works fine.
***However, I want to run this job at midnight rather than 4am which is when logrotate will run.***
I then modified crontab as follows so that the script will run at midnight.
01 * * * * root run-parts /etc/cron.hourly
00 0 * * * root logrotate /etc/logrotate.d/asterisk <===
02 4 * * * root run-parts /etc/cron.daily
22 4 * * 0 root run-parts /etc/cron.weekly
42 4 1 * * root run-parts /etc/cron.monthly
*** My question is if I do this, will the script be run 2 times - one at midnight and another time at 4am?
I just want to run once at midnight.
Any thoughts?
|