I'm running Ubuntu 14.04 LTS and nginx on a Digital Ocean VPS and occasionally receive these emails about a failed cron job:
Subject
Cron test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
The body of the email is:
/etc/cron.daily/logrotate: error: error running shared postrotate script for '/var/log/nginx/*.log ' run-parts: /etc/cron.daily/logrotate exited with return code 1
Any thoughts on how I can resolve this?
Update:
/var/log/nginx/*.log {
weekly
missingok
rotate 52
compress
delaycompress
notifempty
create 0640 www-data adm
sharedscripts
prerotate
if [ -d /etc/logrotate.d/httpd-prerotate ]; then \
run-parts /etc/logrotate.d/httpd-prerotate; \
fi
endscript
postrotate
invoke-rc.d nginx rotate >/dev/null 2>&1
endscript
}
Update:
$ sudo invoke-rc.d nginx rotate
initctl: invalid command: rotate
Try `initctl --help' for more information.
/etc/logrotate.d/nginix
scriptinvoke-rc.d nginx rotate
is failing, try running that as the appropriate user, and show us that script too, paste output into your original question. tks.