By soheilbalini
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
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!
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
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.