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:
tnx
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.
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
Hi. strangely I didn’t receive an email for your response to my question. anyway… I’m grateful for your help
Changing mailto will keep the error from showing up, but you will still have the specified problem. Are you sure that is what you want to do?