Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

Howto monitor and restart services automatically

Discussion in 'General Discussion' started by albatroz, Feb 19, 2007.

  1. albatroz

    albatroz Well-Known Member

    Joined:
    Mar 6, 2003
    Messages:
    320
    Likes Received:
    0
    Trophy Points:
    166
    Location:
    Virtual Orbis / Peru
    cPanel Access Level:
    Root Administrator
    I wonder if someone has a script that can be linked to CRON for restarting services when
    they suddenly stop working.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  2. dalem

    dalem Well-Known Member
    PartnerNOC

    Joined:
    Oct 24, 2003
    Messages:
    2,772
    Likes Received:
    93
    Trophy Points:
    353
    Location:
    SLC
    cPanel Access Level:
    DataCenter Provider
    cpanel all ready has it is called chksrvd you can configure it with your service manager
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,216
    Likes Received:
    10
    Trophy Points:
    313
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    cPanel and WHM actually has such a script built-in. You can add any service you want to /etc/chkserv.d/chkservd.conf

    Chkserv supports two types of monitoring:

    1 - Connection based monitoring: Chkserv will send out a request and anticipate an expected response. If it does not receive the expected response, it will attempt to restart the service. The syntax for adding this type of monitoring to chkservd.conf is as follows:

    - service[serviceName] = port,send,response,restart
    serviceName = Name of service
    response = Expected Response
    restart = Full path to restart service
    send = What data to send

    2 - Command based monitoring: Checks to see if a service (command) is running locally. If not, it attempts to restart it.
    - service[serviceName] = ,,,restart,command,owner
    command is a regular expression

    Chkservd will monitor services periodically, once every 8 minutes.
     
  4. albatroz

    albatroz Well-Known Member

    Joined:
    Mar 6, 2003
    Messages:
    320
    Likes Received:
    0
    Trophy Points:
    166
    Location:
    Virtual Orbis / Peru
    cPanel Access Level:
    Root Administrator
    In my case this is the content of chkserverd.cnf

    named:1
    named:1
    named:1


    However there are 3 other files called
    clamd
    cpsrvd
    eximstats
    named

    For instance this is the content of the clamd file
    service[clamd]=x,x,x,/scripts/restartsrv clamd,clamd,root
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. jayh38

    jayh38 Well-Known Member

    Joined:
    Mar 3, 2006
    Messages:
    1,215
    Likes Received:
    0
    Trophy Points:
    166
    You can easily adjust your basic services via the "service manager" in whm. Check the box on the right of the service you would like monitored.
     
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice