Jump to content

Featured Replies

Posted

Hi,

 

sometimes (rare case) happen that a mysql table got "crashed" and so the website stop working.

 

so my idea is to create bash script which will run hourly/daily (welcome advice) and check all databases tables on linux server. If table is crashed, it will try to fix it and also send an email to admin. Email: "It appears that table $tablename" in $dbname database was crashed and there was an attempt to repair it. Please check if corresponding website works."

 

this checks all dbs and autorepair

Code:

mysqlcheck -u [username] -p[password] --all-databases --check --auto-repair

aditional parameters:

Code:

-C, –check-only-changed Check tables that are changed since last check

-F, –fast Check tables that are not closed properly

-r, –repair Fix the table corruption

..The task should be take minimum server resources..

 

But if i want to mail an crashed/repaired mysql table name as an variable, im unsure how to extract this name from mysqlcheck output

 

any ideas pls? or is there any already made script?

 

 

------

There is an optimisation script: http://www.lxg.de/code/shell-script-...atabases-mysql

 

Continue reading...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...