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.

cron for restarting sql

Discussion in 'Database Discussions' started by DigiCrime, Oct 3, 2011.

  1. DigiCrime

    DigiCrime Well-Known Member

    Joined:
    Nov 27, 2002
    Messages:
    399
    Likes Received:
    0
    Trophy Points:
    16
    crontab -e at the bottom I just added a line to restart mysql at 11 o clock at night but but for some reason it was stuck in a loop? I left it to receive an email to make sure it worked but it was stuck in some kind of restart loop so I commented the line out and thought ill deal with it in the morning. Its not there now it disappeared so I dont remember what I had. How should it appear? Thanks

    Think I had * 23 * * * /etc/init.d/mysql restart
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,854
    Likes Received:
    675
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Hello :)

    You may want to consider using the following command in the cron job instead:

    Code:
    /scripts/restartsrv_mysql
    Is there a specific reason you would like to restart MySQL every day on a cron job?

    Thank you.
     
  3. DigiCrime

    DigiCrime Well-Known Member

    Joined:
    Nov 27, 2002
    Messages:
    399
    Likes Received:
    0
    Trophy Points:
    16
    Almost forgot about this. Every few days some of the forums are dragging restarting helps.
     
  4. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    Have you tried checking the MySQL error log during those times to see what might be happening? It is in /var/lib/mysql and usually named hostname.err where hostname is the fully qualified hostname of the machine. Checking the error log might help you to understand why MySQL is degrading periodically on the server.
     
  5. DigiCrime

    DigiCrime Well-Known Member

    Joined:
    Nov 27, 2002
    Messages:
    399
    Likes Received:
    0
    Trophy Points:
    16
    I cleared it out and Ill check it later. I have one forum that gets so high of traffic during a certain time that it doesn't release the memory back to the server it seems, so restarting it just helps. The traffic spike only lasts a couple hours a day

    Thanks
     
Loading...

Share This Page