homepage Welcome to WebmasterWorld Guest from 54.226.80.55
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Hardware and OS Related Technologies / Linux, Unix, and *nix like Operating Systems
Forum Library, Charter, Moderators: bakedjake

Linux, Unix, and *nix like Operating Systems Forum

    
Restart MySql Automatically from CRON
Anyango




msg:3018244
 7:47 am on Jul 22, 2006 (gmt 0)

hello folks

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.

 

lammert




msg:3018266
 9:06 am on Jul 22, 2006 (gmt 0)

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:

#!/bin/sh
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.

Anyango




msg:3031628
 3:33 pm on Aug 2, 2006 (gmt 0)

Hey which log shall i look at to find out why mysql keeps on crashing , i looked at mysql and apache logs but found nothing conclusive as to what causes those crashes.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Hardware and OS Related Technologies / Linux, Unix, and *nix like Operating Systems
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved