Code: Select all
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
[Unit]
StartLimitIntervalSec=0
StartLimitBurst=0
[Service]
Restart=always
RestartSec=5s
EOF
done
systemctl daemon-reload
Code: Select all
php='7.4'
kill -9 $(systemctl status php$php-fpm | grep 'Main PID' | awk '{print $3}')
sleep 1
echo "--- here it should be killed ---"
systemctl status php$php-fpm
sleep 7
echo ""
echo "--- here it should be auto-restarted [active (running)] ---"
systemctl status php$php-fpm