Quantcast
Channel: myVesta
Viewing all articles
Browse latest Browse all 285

PHP • Auto-restart for all PHP-FPM services

$
0
0
If OOM Killer kills FPM services, let's add an auto-restart mechanism:

Code:

for php in $(/usr/local/vesta/bin/v-list-php-apache); do    echo "- Applying auto-restart for PHP $php"    mkdir -p /etc/systemd/system/php$php-fpm.service.d    cat <<EOF >/etc/systemd/system/php$php-fpm.service.d/override.conf[Service]Restart=alwaysRestartSec=5sEOFdonesystemctl daemon-reload
Let's test:

Code:

php='7.4'kill -9 $(systemctl status php$php-fpm | grep 'Main PID' | awk '{print $3}')sleep 1echo "--- here it should be killed ---"systemctl status php$php-fpmsleep 7echo ""echo "--- here it should be auto-restarted [active (running)] ---"systemctl status php$php-fpm

Statistics: Posted by myVesta — Sun Nov 24, 2024 3:33 pm



Viewing all articles
Browse latest Browse all 285

Trending Articles