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

Post Reply
User avatar
myVesta
Site Admin
Posts: 962
Joined: Fri Jun 19, 2020 9:59 am
Has thanked: 10 times
Been thanked: 6 times

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 -
jmart
Posts: 5
Joined: Thu Oct 22, 2020 3:50 pm

Hi!

My database server MARIADB goes down sometimes twice a week and i have to restart it for working.
How do i insert the cron job in myvesta painel?

SOLVED
I did it my way, because I'm not an expert and it works fine now...

1- I downloaded the file from " https://c.myvestacp.com/tools/scanps/scanps.php "
2- I uploaded to /home/scanps.php
3- Made cron job " php8.2 /home/scanps.php > /dev/null 2>&1 "
4- Run command " every minute"

Admin myVesta is that ok???

Thanks,
JMART
Post Reply