Welcome to WebmasterWorld Guest from 18.104.22.168
Forum Moderators: bakedjake
i have been noticing that on a couple of my servers, mysql crashes away under high load and then i have to manually go to restart/start mysql.
is there a script out there somewhere or can we build a one which i set in CRON to execute each 30 mins and check if mysql is not running, run it. simple as that.
i did search for such scripts on web but couldnt find a one.
Environment: Red Hat Linux Enterprise.
any immediate help is highly appreciated.
mysql crashes away under high load
This is not the normal behaviour of MySQL. Have you searched in the log files what the reason is for this crash? I am thinking of the system either running out of file descriptors or running out of memory / swap space.
If you can't find the reason for crashing, the following script can help you in CRON:
NUMBER=`ps --no-heading --user mysql ¦ wc -l`
[ $NUMBER -eq 0 ] && put here your restart command
It first looks for all processes running as user mysql. It counts the number of lines in the output of PS and stores this in a variable. If this is equal to zero, it executes the command behind the &&.
You should replace the '¦' with the proper one without the hole in the center, because the posting software on this forum changes the original character.