Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 14 of 14
  1. #1
    Member
    Join Date
    Sep 2006
    Posts
    17

    Default how to make a task ?

    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. #2
    Member
    Join Date
    Jul 2004
    Posts
    496

    Default

    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. #3
    cPanel Partner NOC cPanel Partner NOC Badge AndyReed's Avatar
    Join Date
    May 2004
    Location
    Minneapolis, MN
    Posts
    2,223

    Default

    Quote Originally Posted by comake View Post
    When I see logs, there is always Mysql problems.
    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
    Andy Reed
    RHCE and CCNA
    ServerTune.com

  4. #4
    Member
    Join Date
    Sep 2006
    Posts
    17

    Default

    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 ?
    Last edited by comake; 11-03-2006 at 02:28 PM.

  5. #5
    Registered User
    Join Date
    Apr 2006
    Posts
    4

    Default 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. #6
    Member
    Join Date
    Sep 2006
    Posts
    17

    Default

    Hello,

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

  7. #7
    Member
    Join Date
    Sep 2006
    Posts
    17

    Default

    Hello, I try on Cpanel Cron panel. I have receveid this email error message

    cat: /var/lib/mysql/comake.comake.com.pid: Permission denied
    Shutting down MySQLkill: usage: kill [-s sigspec | -n signum |
    -sigspec] [pid | job]... or kill -l [sigspec]
    ................................... ERROR!
    rm: cannot remove `/var/lock/subsys/mysql': Permission denied
    Starting MySQL SUCCESS!
    Do you think MySQL have been restarted or not ?

  8. #8
    Member
    Join Date
    Sep 2006
    Posts
    17

    Default

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

    * 8 * * * /etc/init.d/mysql restart
    I want to restart Mysql every hour, is it the right command ?
    0 * * * * /etc/init.d/mysql restart
    I try it on SSH, and I have error message :

    -bash : 0 : command not found

  9. #9
    Member
    Join Date
    May 2006
    Posts
    23

    Default

    You need to setup cron in the root user level to shedule mysql restart on the server
    Vijeesh K

  10. #10
    Member
    Join Date
    Sep 2006
    Posts
    17

    Default

    hello,

    How do you do that ?

    Thank you

  11. #11
    Member
    Join Date
    Sep 2006
    Posts
    17

    Default

    Someone know a good tutorial for it ?
    Last edited by comake; 11-17-2006 at 02:22 PM.

  12. #12
    Member
    Join Date
    Nov 2005
    Posts
    147

    Default

    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.
    cPanel Customer since November 2005
    ---
    - 7 Servers running cPanel/WHM

    Tutorials I have made:
    - Transfer accounts from one server to another

  13. #13
    Member
    Join Date
    Sep 2006
    Posts
    17

    Default

    Thank you.

    I want to make a cron to repair mysql database with this command :
    mysqlcheck -r -u mysqlusername -p databasename
    But SSH ask me the password of mysql database everytime I do this. How to include the password in the ssh sentence ?

  14. #14
    Member
    Join Date
    Jan 2004
    Location
    co
    Posts
    5

    Default

    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
    John Marc

Similar Threads & Tags
Similar threads

  1. scheduled task in win 2008
    By parag joshi in forum New User Questions
    Replies: 1
    Last Post: 05-08-2009, 10:37 AM
  2. How to make an appointment a task in cron every 3 days?
    By romzinho in forum cPanel and WHM Discussions
    Replies: 2
    Last Post: 11-15-2007, 05:42 PM
  3. Cannot Schedule Cron Awstats Update Task
    By stewartn in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 05-13-2004, 10:19 PM
  4. High load with cpanel task
    By Sopos in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 02-13-2004, 02:45 AM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube