Report this

What is the reason for this report?

Daily emails from Cron to Root

Posted on December 10, 2014

I recently Installed postfix (and I redirected all emails to Gmail) every day I receive an email from Cron to root@mydomain, that contains this message:

/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

the things that I have done recently:

  • my Host name was not a fully qualified domain name so I changed it in Ubuntu hostname file to a domain (probably unrelated :) )
  • I read somewhere to change cron mailto to " " will solve the problem. is it true?

tnx



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hi. strangely I didn’t receive an email for your response to my question. anyway… I’m grateful for your help

It looks like this is a known bug in the php5 package: Bug #1230917 “php5-fpm logrotate errors after package switched t…” : Bugs : php5 package : Ubuntu.

You can manually fix it so that you don’t have to wait for a package update to be pushed.

Edit /etc/logrotate.d/php5-fpm and replace

	postrotate
		invoke-rc.d php5-fpm reopen-logs > /dev/null
	endscript

with

	postrotate
		/usr/lib/php5/php5-fpm-reopenlogs
	endscript

Then, create a file in /usr/lib/php5 called php5-fpm-reopenlogs:

sudo mkdir -p /usr/lib/php5
sudo touch /usr/lib/php5/php5-fpm-reopenlogs
sudo chmod +x /usr/lib/php5/php5-fpm-reopenlogs

with the following content:

#!/bin/sh
CONFFILE=/etc/php5/fpm/php-fpm.conf
[ -r /etc/default/php5-fpm ] && . /etc/default/php5-fpm
CONF_PIDFILE=$(sed -n 's/^[[:space:]]*pid[[:space:]]*=[[:space:]]*//p' $CONFFILE)
PIDFILE=${CONF_PIDFILE:-/run/php5-fpm.pid}
[ -r "$PIDFILE" ] && kill -USR1 $(cat "$PIDFILE") > /dev/null
exit 0

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.