Why does my logrotate.conf file work correctly when logged in as root, but fail when executed as part of cron.daily?
I have a few custom application logs that I want to rotate automatically using logrotate. I picked as a base template, the logrotate.conf file that gets installed for Apache:
/sbin/service httpd reload > /dev/null 2>/dev/null || true
Here are two logrotate.conf entries that I created:
If I sudo as root and execute "/usr/sbin/logrotate hellanzb" the command executes without any errors. However, every time the cronjob "/etc/cron.daily/logrotate" runs I get a bunch of error messages:
sh: line 2: missingok: command not found
sh: line 3: nomail: command not found
sh: line 4: weekly: command not found
sh: line 5: rotate: command not found
sh: line 2: ifempty: command not found
sh: line 3: missingok: command not found
sh: line 4: nomail: command not found
sh: line 5: daily: command not found
sh: line 6: rotate: command not found
I've checked the permissions for both the logrotate.conf files and the actual log files and they seems to be identical as far as my applications and Apache goes - so why the errors?
OS Info - CentOS 5, 64-bit running on a VPS.