You are not logged in.
Pages: 1
i'm trying to configure when logrotate runs. i created a text file called clearlog with the following content:
# rotate logs
09 17 * * * root /usr/sbin/logrotate -f /etc/logrotate.conf >/dev/null 2>&1
i then placed it in /etc/cron.d.
but the logs weren't rotated at 5.09pm, even though they should have been given the details in logrotate.conf.
did i make a mistake somewhere?
Last edited by anti-destin (2010-01-15 14:48:47)
Offline
You might want read http://bugs.archlinux.org/task/16085 + discussion on the mailing lists
Evil #archlinux@libera.chat channel op and general support dude.
. files on github, Screenshots, Random pics and the rest
Offline
You might also have a look at metalog, which has log-rotating functionality built in.
Offline
You might want read http://bugs.archlinux.org/task/16085 + discussion on the mailing lists
thanks for the information. i didn't realize dcron didn't look in /etc/cron.d.
You might also have a look at metalog, which has log-rotating functionality built in.
thanks. i'll check it out.
i went ahead and edited my user crontab. i added this:
# rotate logs
20 18 * * * /usr/sbin/logrotate -f /etc/logrotate.conf >/dev/null 2>&1
(i took out the user and changed the time to test it.)
again, the files weren't rotated. is there a mistake in my crontab?
Last edited by anti-destin (2010-01-14 00:27:20)
Offline
You edited your user's or root's crontab? Obviously, your user doesn't have permission to rotate logs.
Do you need all this? There's logrotate in /etc/cron.daily/.
Offline
thank you, lucke! all i needed to do was edit the root crontab and change cron.daily time.
Offline
The existing version of dcron already does do /etc/cron.d stuff. I don't know why some people are having trouble with it, ore reporting this functionality as something dcron "doesn't do". (There was a point where dcrond didn't do it, but that was a long time ago.)
In any case, I took over development of dcron with the 4.x series, which is now in [testing], and this should handle /etc/cron.d fine. Complain to me if it doesn't.
In this case, I think logrotate will only rotate logs at most once a day unless you force it. Perhaps your second cron job was calling logrotate but logrotate wasn't doing anything because it had already run?
Offline
thanks for the information, profjim. it was most likely a permissions issue. (i used the -f switch, so logrotate should have run.)
in any case, editing the root crontab is a better solution. it's far simpler and doesn't require that files be added to cron.d.
Offline
Pages: 1