Restart services on failure using systemd
We've noticed that Plesk services like plesk-php72-fpm are sometimes killed by the out of memory killer or otherwise crash and require manual intervention by us. The services could be made more resilient by adding the following file to supplement Plesk's service file and reloading systemd.
cat /root/reload-on-fail.conf
[Service]
Restart=on-failure
RestartSec=5s
cp /root/reload-on-fail.conf /usr/lib/systemd/system/plesk-php*-fpm.service.d/reload-on-fail.conf && systemctl daemon-reload
I've also made an ansible playbook for this:
https://gist.github.com/nbeernink/679b8c0bc635158b0ea4dfb96e10c7c5
Additionally, you can also add this to services like nginx, mysql/mariadb, dovecot and postfix and they will restart on failure as well.
However instead of us all running these playbooks on old and new servers, it would be great if this would be provided by Plesk by default, that way it's a benefit to everyone.
Available since Plesk Obsidian: https://docs.plesk.com/release-notes/obsidian/change-log/#18-preview11
— rk
-
Niek Beernink commented
Igor, the watchdog extension does not actually support Plesk's multiple PHP-FPM versions only the OS-vendor's version. Your link also mentions this and I should have mentioned this in my initial request.
The interface also isn't on-par with Onyx' look & feel if you ask me.
So this is an alternative way to fix it for all versions using systemd's restart-on-failure option.