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 do you restart services from shell?

Discussion in 'General Discussion' started by bjdea1, Jun 17, 2004.

  1. bjdea1

    bjdea1 Well-Known Member

    Joined:
    Mar 6, 2003
    Messages:
    83
    Likes Received:
    1
    Trophy Points:
    8
    Hi,
    quick question - how do you restart services from ssh command line, such as Apache and exim and MySQL and all th rest - just like in WHM? Reason I ask is I'm writing a process monitoring script that will restart services if the load gets too high, if that fails then it'll reboot the server. I am going to make it more complicated later on - where it kills off individual processes that are actually causing the problem - but for now can some help me out with this first step.

    What are the simple commands to restart the services, I've looked eveywhere can't find the commands anywhere

    Or alternatively where are the restart scripts in WHM stored? could just run these.
     
    #1 bjdea1, Jun 17, 2004
    Last edited: Jun 17, 2004
  2. bjdea1

    bjdea1 Well-Known Member

    Joined:
    Mar 6, 2003
    Messages:
    83
    Likes Received:
    1
    Trophy Points:
    8
    found em

    Nevermind - I found the answer already - all the restarting commands are in /etc/rc.d/init.d directory
     
  3. Steve-PWH

    Steve-PWH Well-Known Member

    Joined:
    Jun 30, 2002
    Messages:
    116
    Likes Received:
    0
    Trophy Points:
    16
    Also scripts in there using RH can be called with

    service <service name> <args>

    I.e.

    service httpd restart
     
  4. coastinc

    coastinc Well-Known Member

    Joined:
    Mar 13, 2002
    Messages:
    159
    Likes Received:
    0
    Trophy Points:
    16
    You can also use the CPanel scripts as they give you a tail of the logs after restarting.

    cd /scripts
    ./restartsrv servicename
     
Loading...

Share This Page