The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How To Repair Databases with Cronjob

Discussion in 'General Discussion' started by ronowicker, Jan 4, 2007.

  1. ronowicker

    ronowicker Member

    Joined:
    Aug 3, 2003
    Messages:
    20
    Likes Received:
    0
    Trophy Points:
    1
    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. gupi

    gupi Well-Known Member

    Joined:
    Apr 27, 2004
    Messages:
    125
    Likes Received:
    0
    Trophy Points:
    16
    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.
     
  3. motorspade

    motorspade Registered

    Joined:
    Sep 29, 2007
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Venezuela
    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.
     
Loading...

Share This Page