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.

Need to crond to restart MySQL and httpd

Discussion in 'General Discussion' started by SupermanInNY, Jan 6, 2005.

  1. SupermanInNY

    SupermanInNY Well-Known Member

    Joined:
    Jul 19, 2003
    Messages:
    255
    Likes Received:
    0
    Trophy Points:
    16
    Hi there,

    My machine has only 1GB of RAM on it. I ordered 3GB more, but it will be about 10 days till they arrive and get installed.

    In the meantime, I have a surge of activity on my server and I'm already using swap.... 50% of the swap!!

    You can imagine how terrible the server is acting.

    To resolve this problem, (temporarily) I restart two services every 25 minutes:

    service mysql restart
    service httpd restart

    How can I set this to run automatically?
    I want the have this run every 20 minutes. This is certainly not a permanent solution, but I have no choice until I get my new memory chips.

    Can you walk me through the process of adding a crond to run these services?
    I'd like mysql to restart every 20 minutes and httpd every 21 minutes.

    I tried to run these as a user using the control panel, but I don't know the correct syntax to make it run.
    I placed a file called:

    http.sh in my home directory, and called it, but in it, I didn't put the correct syntax. I put the:

    service mysql restart

    And when the crond ran, the email msg it sent me was: "unknown operation service". So, I need to have a direct call to stop/start mysql using a cron job.

    Thanks,

    -Alon.
     
  2. Blue|Fusion

    Blue|Fusion Well-Known Member

    Joined:
    Sep 12, 2004
    Messages:
    378
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Cleveland, Ohio
    edit /etc/crontab with the following:

    Save the file.

    service crond restart
     
    #2 Blue|Fusion, Jan 6, 2005
    Last edited: Jan 6, 2005
  3. SupermanInNY

    SupermanInNY Well-Known Member

    Joined:
    Jul 19, 2003
    Messages:
    255
    Likes Received:
    0
    Trophy Points:
    16
    Yup!

    That did the trick!

    I was also given the same edit option using: crontab -e (Thanks to Eric Gregory)
    and I think it automatically reload the service upon exist.

    Anyways, Thanks for the script.

    -Alon.
     
Loading...

Share This Page