Mysql Monitor Script That Can Restart Mysql Server

Problem: my mysql server crashes once a week due to agressive bots (google, baidu…)

I would like to run a little cron job evey minute to check mysql status that can bring mysql server back alive after a crash.

Something a la:

mysqladmin ping
if [ $? -ne 0 ]
then
/etc/init.d/mysqld start
else
echo “All is well”
fi

Could do the job, the only problem is that I can’t get the mysql up again with ‘start’ or ‘restart’ service. I need to reboot the whole server before mysql server r…

Leave a Reply

Your email address will not be published. Required fields are marked *