Been weeks, even months, that after a logrotate, my Apache2 server suddenly stops and can't restart, mainly because of the password on the cert. but I do not want to remove it.
At the beginning I thought it was due to Logrotate. But then, I monitored it better and made some tests and this was not the cause.
I searched logs everywhere until this morning, when it crashed again, and I found this:
error.log
[Wed Aug 03 06:34:41.322231 2016] [mpm_prefork:notice] [pid 2726] AH00169: caught SIGTERM, shutting down
[Wed Aug 03 06:34:42.301179 2016] [ssl:info] [pid 18371] AH02200: Loading certificate & private key of SSL-aware server 'aa.bb.cc:443'
syslog
Aug 3 06:34:40 myserver php5-common: php5_invoke pdo: already enabled for apache2 SAPI
Aug 3 06:34:40 myserver php5-common: php5_invoke pdo: already enabled for cli SAPI
Aug 3 06:34:40 myserver php5-common: php5_invoke opcache: already enabled for apache2 SAPI
Aug 3 06:34:40 myserver php5-common: php5_invoke opcache: already enabled for cli SAPI
Aug 3 06:34:40 myserver php5-cli: php5_invoke opcache: already enabled for cli SAPI
Aug 3 06:34:40 myserver php5-cli: php5_invoke pdo_pgsql: already enabled for cli SAPI
Aug 3 06:34:40 myserver php5-cli: php5_invoke json: already enabled for cli SAPI
Aug 3 06:34:40 myserver php5-cli: php5_invoke pdo: already enabled for cli SAPI
Aug 3 06:34:40 myserver php5-cli: php5_invoke pgsql: already enabled for cli SAPI
Aug 3 06:34:40 myserver php5-cli: php5_invoke readline: already enabled for cli SAPI
Aug 3 06:34:40 myserver php5-readline: php5_invoke readline: already enabled for apache2 SAPI
Aug 3 06:34:40 myserver php5-readline: php5_invoke readline: already enabled for cli SAPI
Aug 3 06:34:41 myserver libapache2-mod-php5: php5_invoke opcache: already enabled for apache2 SAPI
Aug 3 06:34:41 myserver libapache2-mod-php5: php5_invoke pdo_pgsql: already enabled for apache2 SAPI
Aug 3 06:34:41 myserver libapache2-mod-php5: php5_invoke json: already enabled for apache2 SAPI
Aug 3 06:34:41 myserver libapache2-mod-php5: php5_invoke pdo: already enabled for apache2 SAPI
Aug 3 06:34:41 myserver libapache2-mod-php5: php5_invoke pgsql: already enabled for apache2 SAPI
Aug 3 06:34:41 myserver libapache2-mod-php5: php5_invoke readline: already enabled for apache2 SAPI
Aug 3 06:34:41 myserver libapache2-mod-php5: apache2_invoke php5: already enabled
Aug 3 06:34:42 myserver apache2: No way to ask user for passphrase
alternatives.log.1
update-alternatives 2016-08-03 06:34:40: run with --install /usr/bin/php php /usr/bin/php5 50 --slave /usr/share/man/man1/php.1.gz php.1.gz /usr/share/man/man1/php5.1.gz
I guess I finally found why my server suddenly stops working. But I do not know what update-alternatives is for, I have never heard of it and would need advices on how to move, to solve my problem. It can be both updating php or stopping this program from running at 6.34 AM, or stopping at all.
Any advice is greatly appreciated!
EDIT: Best answer (and only one) marked as accepted because I found out my system was installing updates, among these, the php. Which let the system both having updated version of php and improper shut down of the apache service, due to the certificate. I want the password on the certificate, so disabling the updates with
dpkg-reconfigure -plow unattended-upgrades
seemed that resolved my problem. But I can not be sure.. Have to wait the next SIGTERM, if there will ever be.
See
man update-alternatives
for a description of the alternatives systemThis is the command being run on your system
I'm not sure why, but I'm wondering if you have automatic updates enabled. If a new php was installed, this command might be executed.
If I'm correct, disabling automatic updates should fix your problem. Otherwise it's likely a cron job, but I couldn't find anything on my Ubuntu system that looked like it would do that.