Apache2.4.25 - caught SIGTERM, shutting down

Debian macht sich hervorragend als Web- und Mailserver. Schau auch in den " Tipps und Tricks"-Bereich.
Antworten
BrotherJ
Beiträge: 323
Registriert: 15.11.2018 07:56:18

Apache2.4.25 - caught SIGTERM, shutting down

Beitrag von BrotherJ » 31.07.2019 09:36:59

Hallo zusammen,

auf einem Apache2-Server (Debian/Stretch), der seit 78 Tagen läuft, wurde am 17.7. um 5:20 Uhr der Apache-Service gestoppt.

Code: Alles auswählen

[Tue Jul 16 06:46:15.980910 2019] [:error] [pid 12424] [client 118.24.230.15:26123] script '/srv/www/html/shell.php' not found or unable to stat
[Tue Jul 16 06:46:18.670365 2019] [:error] [pid 12424] [client 118.24.230.15:26123] script '/srv/www/html/12.php' not found or unable to stat
[Tue Jul 16 06:46:19.528355 2019] [:error] [pid 12424] [client 118.24.230.15:26123] script '/srv/www/html/ecmsmod.php' not found or unable to stat
[Tue Jul 16 06:46:20.004602 2019] [:error] [pid 12424] [client 118.24.230.15:26123] script '/srv/www/html/index.php' not found or unable to stat
[Tue Jul 16 06:46:28.099051 2019] [:error] [pid 12424] [client 118.24.230.15:26123] script '/srv/www/html/user.php' not found or unable to stat, referer: 554fcae493e564ee0dc75bdf2ebf94caads|a:3:{s:2:"id";s:3:"'/*";s:3:"num";s:141:"*/ union select 1,0x272F2A,3,4,5,6,7,8,0x7b247b24524345275d3b6469652f2a2a2f286d6435284449524543544f52595f534550415241544f5229293b2f2f7d7d,0--";s:4:"name";s:3:"ads";}554fcae493e564ee0dc75bdf2ebf94ca
[Tue Jul 16 06:46:29.095549 2019] [:error] [pid 12424] [client 118.24.230.15:26123] script '/srv/www/html/search.php' not found or unable to stat
[Tue Jul 16 06:46:29.478622 2019] [:error] [pid 12424] [client 118.24.230.15:26123] script '/srv/www/html/index.php' not found or unable to stat
[Wed Jul 17 05:20:41.063133 2019] [mpm_prefork:notice] [pid 15749] AH00169: caught SIGTERM, shutting down
[Wed Jul 17 05:20:42.112761 2019] [mpm_prefork:notice] [pid 18008] AH00163: Apache/2.4.25 (Debian) OpenSSL/1.0.2l configured -- resuming normal operations
[Wed Jul 17 05:20:42.112818 2019] [core:notice] [pid 18008] AH00094: Command line: '/usr/sbin/apache2'
[Wed Jul 17 05:20:48.597740 2019] [mpm_prefork:notice] [pid 18008] AH00171: Graceful restart requested, doing restart
[Wed Jul 17 05:20:48.640942 2019] [mpm_prefork:notice] [pid 18008] AH00163: Apache/2.4.25 (Debian) OpenSSL/1.0.2l configured -- resuming normal operations
[Wed Jul 17 05:20:48.640976 2019] [core:notice] [pid 18008] AH00094: Command line: '/usr/sbin/apache2'
[Wed Jul 17 05:20:50.099346 2019] [mpm_prefork:notice] [pid 18008] AH00171: Graceful restart requested, doing restart
[Wed Jul 17 05:20:50.137101 2019] [mpm_prefork:notice] [pid 18008] AH00163: Apache/2.4.25 (Debian) OpenSSL/1.0.2l configured -- resuming normal operations
[Wed Jul 17 05:20:50.137120 2019] [core:notice] [pid 18008] AH00094: Command line: '/usr/sbin/apache2'
[Wed Jul 17 05:20:50.234055 2019] [mpm_prefork:notice] [pid 18008] AH00169: caught SIGTERM, shutting down
Ich dachte erst, das wäre die Folge dieser vielen Abfragen von "client 118.24.230.15:26123", aber das war ein Tag zuvor. Was kann das SIGTERM sonst verursacht haben? Ich habe keine Software installiert, die selber den Apache steuern würde.

Grüße und vielen Dank

BrotherJ

DeletedUserReAsG

Re: Apache2.4.25 - caught SIGTERM, shutting down

Beitrag von DeletedUserReAsG » 31.07.2019 09:48:58

Cronjob? Logrotate (um die Logfiles zu schließen)?

BrotherJ
Beiträge: 323
Registriert: 15.11.2018 07:56:18

Re: Apache2.4.25 - caught SIGTERM, shutting down

Beitrag von BrotherJ » 31.07.2019 13:08:38

Ja und zwar Folgende:

Backupscripte, die aber Apache2 nicht stoppen oder starten "00 23 * * 0" und "40 23 * * 0".
Cerbot mit

Code: Alles auswählen

0 0 * * * /usr/bin/certbot renew --pre-hook "systemctl stop apache2" --post-hook "systemctl start apache2" >> /var/log/letsencrypt/letsencrypt.log
Daily:
Logrotate
Apache:

Code: Alles auswählen

/var/log/apache2/*.log {
        daily
        missingok
        rotate 14
        compress
        delaycompress
        notifempty
        create 640 root adm
        sharedscripts
        postrotate
                if /etc/init.d/apache2 status > /dev/null ; then \
                    /etc/init.d/apache2 reload > /dev/null; \
                fi;
        endscript
        prerotate
                if [ -d /etc/logrotate.d/httpd-prerotate ]; then \
                        run-parts /etc/logrotate.d/httpd-prerotate; \
                fi; \
        endscript
}
Das war es eigentlich auch schon und zusätzlich passen daily, weekly, monthly mit 6:25 Uhr, 6:47 Uhr und 6:52 Uhr schlecht auf die Uhrzeit des Shutdowns.

BrotherJ
Beiträge: 323
Registriert: 15.11.2018 07:56:18

Re: Apache2.4.25 - caught SIGTERM, shutting down

Beitrag von BrotherJ » 31.07.2019 15:47:09

Ich weiß jetzt zwar noch nicht, warum es den Server gekillt hatte, aber ich habe mittels diesem kleinen Skript und einem Daily-Cronjob dafür gesorgt, dass der Server maximal 24 h still steht im Worst Case

Code: Alles auswählen

#!/bin/bash
if [ $(/bin/systemctl status apache2 | grep 'Active: active (running)' | wc -l) = 0 ]
then
        /bin/systemctl start apache2.service
        echo "Restart of Apache2 service because of status 'inactive (dead)'" | logger -i -t apache2check 
else
        echo "Status of Apache2 service is 'active (running)'" | logger -i -t apache2check
fi

Antworten