Page 1 of 1

Cronjob that checks if MariaDB/MySQL is not killed by OOM Killer

Posted: Wed Nov 09, 2022 7:35 pm
by myVesta
This script is checking if MySQL/MariaDB server process is up.
If it's not, it assumes that it was killed by Kernel OOM Killer, and reboots the server, in order to bring the back server to a normal state.
It can detect 'apt upgrade' process and avoid a reboot.

We mostly run this script from cronjob every 5 minutes:

Code: Select all

wget -nv -O /home/scanps.php https://c.myvestacp.com/tools/scanps/scanps.php
chmod u+x /home/scanps.sh
crontab -l | { cat; echo "*/5 * * * * php /home/scanps.php > /dev/null 2>&1"; } | crontab -