Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 3 of 3
  1. #1
    Member
    Join Date
    Aug 2003
    Posts
    20

    Default How To Repair Databases with Cronjob

    I'm hoping someone might have an easy solution with an issue I repeatedly have.

    I have a few servers where I have cronjobs that add new news to drupal sites periodically through the day. That works fine and dandy. The problem that comes up from time to time is I get a database error that causes the site to stop working. Well I can get into WHM and run the "Repair a Database" function and it fixes the problem every time.

    I'm wondering if there is a way I can setup "ONE" cronjob that will run this repair on "ALL" databases to fix any errors that might occur?

    I do understand I can setup a cronjob for every database, but I'm hoping one of you really smart linux guys might know of a way to do this so I don't have to add a cronjob each time there is a new site added.

    For example, to run a repair on one database it is something like this:

    scripts/repairmysql?user=XXXXX&submit=Repair+Database

    Is there a way to make it so the XXXXX is a "allusers" or even leave that part out so it goes methodically down the list and runs a repair on all of them?

    I appreciate any help.

  2. #2
    Member gupi's Avatar
    Join Date
    Apr 2004
    Posts
    125

    Default

    the command
    Code:
    mysqlcheck --check --all-databases --optimize
    should do the job, if run as root.

    short version: mysqlcheck -c -A -o
    Anyway, check the man page for details.
    Stefaniu -gupi- Criste
    Hangar Hosting - a safe place for your Romanian online business

  3. #3
    Registered User
    Join Date
    Sep 2007
    Location
    Venezuela
    Posts
    1

    Exclamation please, i really need the sript repair cron job

    I´m a newbie, my web falls every night untill I manually enter c-panel and run repair db. It happens (web fail) always at the same hour. I need the code (script) to program a cron job repair. Please, is very urgent I need Vacations!! (The script posted in this forum didn't reapir my db, I had to manually repair it). Please help. Thanks.

Similar Threads & Tags
Similar threads

  1. Cpanel script repair
    By liang3391 in forum cPanel and WHM Discussions
    Replies: 2
    Last Post: 07-15-2009, 08:14 PM
  2. How can we repair this problem?
    By mOmiX in forum New User Questions
    Replies: 3
    Last Post: 01-12-2007, 02:38 AM
  3. Database Repair
    By jackal in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 08-30-2003, 07:38 AM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube