0

Hi i have directory where i keep logrotate configs. Let's say /directory1/scripts/logrotate/logrotate_1.conf All of them are similar.

logrotate_1.conf

su root root
/zzz/env/yyy/tomcat/logs/catalina.out {
rotate 90
copytruncate
missingok
dateext
dateformat -%Y-%m-%d_%H%M.log
compress
lastaction
mv /zzz/env/yyy/tomcat/logs/*.gz /zzz/env/yyy/logs/archive
chown www-data:www-data /zzz/env/yyy/logs/archive -R
endscript
}

in crontab i set to run logrotate like this and every think is working fine.

59 23 * * * /usr/sbin/logrotate -f /uniter/scripts/logrotate/logrotate_1.conf
58 23 * * * /usr/sbin/logrotate -f /uniter/scripts/logrotate/logrotate_2.conf
57 23 * * * /usr/sbin/logrotate -f /uniter/scripts/logrotate/logrotate_3.conf

BUT when i set to run logrotate like this is not working properly. One day i have log just from first line, next day form first and third ect.

59 23 * * * /usr/sbin/logrotate -f /uniter/scripts/logrotate/logrotate_1.conf
59 23 * * * /usr/sbin/logrotate -f /uniter/scripts/logrotate/logrotate_2.conf
59 23 * * * /usr/sbin/logrotate -f /uniter/scripts/logrotate/logrotate_3.conf

It look like there is a problem running logrotate at the same time. Could you explain to me why is happening like that.

1 Answer 1

0

logrotate uses a state file to keep track of its actions. You must only have one instance of logrotate, even if it has several different rotation configurations. Failing that, specify a different state file (-s) with each instance.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .