Sunday, 24 August 2014

FIXED: Ubuntu Server cron error message: invoke-rc.d: initscript php5-fpm, action "reopen-logs" failed in logrotate

Found a simple fix for this error in my Ubuntu Server 14.04 cron logs arising from one of the logrotate scripts:-
/etc/cron.daily/logrotate:
initctl: invalid command: reopen-logs
Try `initctl --help' for more information.
invoke-rc.d: initscript php5-fpm, action "reopen-logs" failed.
error: error running non-shared postrotate script for /var/log/php5-fpm.log of '/var/log/php5-fpm.log '
run-parts: /etc/cron.daily/logrotate exited with return code 1


This comes from /etc/logrotate.d/php5-fpm :-

/var/log/php5-fpm.log {
    rotate 12
    weekly
    missingok
    notifempty
    compress
    delaycompress
    postrotate
        invoke-rc.d php5-fpm reopen-logs > /dev/null
    endscript
}


The problem is that the php5-fpm init script doesn't have a parameter 'reopen-logs'.

So the simple fix is to change 'reopen-logs' to 'restart'.

Presumably this is an error in the php5-fpm package, i.e. the installation script has set up a logrotate entry that calls their package with an invalid argument. Easily fixed anyway.



5 comments:

  1. Thanks voor sharing your message.

    ReplyDelete
  2. I just received the same error. Many thanks for sharing this, a problem solved.

    ReplyDelete
  3. Helpful post. Fixed my Ubuntu 14.04 LTS.

    ReplyDelete
  4. Thx - same error ... same fix ...

    ReplyDelete
  5. Thank you very much for the fix!

    ReplyDelete

Spammers: please stop wasting my time. All comments are moderated before publication.