I have the following entry in /etc/crontab
47 * * * * root /usr/sbin/logrotate -v -f /etc/logrotate.d/mariadb_dumps &> /tmp/errrot
The line is run because the /tmp/errrot if created (empty), however logrotate does nothing.
If I run the line on command line out of cron, it works fine and it outputs to /tmp/errrot.
The file /etc/logrotate.d/mariadb_dumps has:
/home/backups/alldbs.sql.gz {
rotate 48
create 640 root adm
notifempty
nocreate
}
Packages are:
cronie-1.4.11-19.el7.x86_64
cronie-anacron-1.4.11-19.el7.x86_64
OS is CentOS 7
What should I modify to run logrotate hourly?
Note: I've tried even putting the line in a separate file in /etc/cron.d and even setting a custom path for logrotate as in How to execute logrotate every hour. None of those approaches work.
&>(as a redirection) is a bashism - are you sure cron is running jobs with bash (rather than POSIXsh)? if not, it may explain why the error file is empty