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 make a task ?

Discussion in 'Database Discussions' started by comake, Nov 2, 2006.

  1. comake

    comake Member

    Joined:
    Sep 10, 2006
    Messages:
    16
    Likes Received:
    0
    Trophy Points:
    1
    Hello,

    I would like to restart Mysql every special hours of the day like 8 PM. Because I have more than 5000 visits/day and the server is very slow and the site display a blank page.
    When I see logs, there is always Mysql problems.

    I am a newbie.

    Someone know how I could make a cron on Cpanel or a special task on Web host manager to reboot Mysql at 2PM, 8PM and 11PM every day ?
     
  2. kernow

    kernow Well-Known Member

    Joined:
    Jul 23, 2004
    Messages:
    865
    Likes Received:
    9
    Trophy Points:
    18
    cPanel Access Level:
    Root Administrator
    I can give you the scipt to create this, but its a pointless task, You need to address the issues of why mysql is over loading your server. You might want to pay for a server tune up at: sales@rack911.com
     
  3. AndyReed

    AndyReed Well-Known Member
    PartnerNOC

    Joined:
    May 29, 2004
    Messages:
    2,222
    Likes Received:
    3
    Trophy Points:
    38
    Location:
    Minneapolis, MN
    The problem is definitely not MySQL. The problem might be caused by a malicious script or a "runaway script" which can continuously loop, dragging down MySQL resources. You need find out the real cause and stop it from killing your server. Just in case you have time, read more about the causes of high server load:

    http://www.vbulletin.com/forum/showthread.php?t=19275
     
  4. comake

    comake Member

    Joined:
    Sep 10, 2006
    Messages:
    16
    Likes Received:
    0
    Trophy Points:
    1
    Hello,


    Thank you for your answers. I am very newbie and I don't know how to find the error and I will not be able to correct it too.

    I just want to run :

    /etc/init.d/mysql restart

    at a special hour of the day.

    Do you know the command to restart apache too ?
     
    #4 comake, Nov 3, 2006
    Last edited: Nov 3, 2006
  5. neo32

    neo32 Registered

    Joined:
    Apr 9, 2006
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    Hello....comake

    here is a example to run a cron to restart mysql at 8.00am every day.

    * 8 * * * /etc/init.d/mysql restart

    If you have aany further clarification then please contact me at neogomez32@yahoo.co.in

    All the best.. :)
     
  6. comake

    comake Member

    Joined:
    Sep 10, 2006
    Messages:
    16
    Likes Received:
    0
    Trophy Points:
    1
    Hello,

    Do you know if I can write that kind of cron on Cpanel cron section ?
     
  7. comake

    comake Member

    Joined:
    Sep 10, 2006
    Messages:
    16
    Likes Received:
    0
    Trophy Points:
    1
    Hello, I try on Cpanel Cron panel. I have receveid this email error message

    Do you think MySQL have been restarted or not ?
     
  8. comake

    comake Member

    Joined:
    Sep 10, 2006
    Messages:
    16
    Likes Received:
    0
    Trophy Points:
    1
    I want to restart Mysql every hour, is it the right command ?
    I try it on SSH, and I have error message :

     
  9. vijeesh

    vijeesh Member

    Joined:
    May 26, 2006
    Messages:
    23
    Likes Received:
    0
    Trophy Points:
    1
    You need to setup cron in the root user level to shedule mysql restart on the server
     
  10. comake

    comake Member

    Joined:
    Sep 10, 2006
    Messages:
    16
    Likes Received:
    0
    Trophy Points:
    1
    hello,

    How do you do that ?

    Thank you
     
  11. comake

    comake Member

    Joined:
    Sep 10, 2006
    Messages:
    16
    Likes Received:
    0
    Trophy Points:
    1
    Someone know a good tutorial for it ?
     
    #11 comake, Nov 17, 2006
    Last edited: Nov 17, 2006
  12. HelloAdam

    HelloAdam Well-Known Member

    Joined:
    Nov 6, 2005
    Messages:
    145
    Likes Received:
    0
    Trophy Points:
    16
    Hey,

    What other forgot to say was you need to do this.

    In SSH type,

    Code:
    crontab -e
    
    then you want to input

    Code:
    * 1 * * * /etc/init.d/mysql restart
    
    This hit on your keyboard

    Code:
    CTRL X
    
    and y then enter

    That will do it!

    You may also think about getting a Server Management. Where people who know servers take care of it.

    This will restart MySQL every 1 hour for every day, every week, every month, every year.
     
  13. comake

    comake Member

    Joined:
    Sep 10, 2006
    Messages:
    16
    Likes Received:
    0
    Trophy Points:
    1
    Thank you.

    I want to make a cron to repair mysql database with this command :
    But SSH ask me the password of mysql database everytime I do this. How to include the password in the ssh sentence ?
     
  14. jmarcv

    jmarcv Member

    Joined:
    Jan 31, 2004
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    co
    create this file:
    /root/.my.cnf
    [client]
    user="mysqlusername"
    pass="mysqluserpass"

    then you only have to type

    mysqlcheck -r databasename


    or

    mysqlcheck -r -u mysqlusername -p mysqluserpass databasename
     

Share This Page