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!

Cron Jobs for restart services

Discussion in 'General Discussion' started by mnaudon, Mar 22, 2004.

  1. mnaudon

    mnaudon Registered

    Joined:
    Feb 13, 2004
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    151
    Location:
    Santiago de Chile
    How can i create a cron job that restart a service (like cpaneld, exim, apache, etc.) if that service will fail?
     
  2. chirpy

    chirpy Well-Known Member

    Joined:
    Jun 15, 2002
    Messages:
    13,460
    Likes Received:
    22
    Trophy Points:
    463
    Location:
    Go on, have a guess
    One already exists for cPanel - chkservd
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. beachtrader

    beachtrader Active Member

    Joined:
    Feb 21, 2003
    Messages:
    37
    Likes Received:
    0
    Trophy Points:
    156
    How often does this run?

    Can it be changed?
     
  4. chirpy

    chirpy Well-Known Member

    Joined:
    Jun 15, 2002
    Messages:
    13,460
    Likes Received:
    22
    Trophy Points:
    463
    Location:
    Go on, have a guess
    Have a look in the script file:

    /usr/sbin/chkservd

    Looks like it runs every 500 seconds. You could modify the script to run more/less frequently, but the script will probably be overwritten every time you upgrade cPanel.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. markhard

    markhard Well-Known Member

    Joined:
    Apr 22, 2004
    Messages:
    250
    Likes Received:
    0
    Trophy Points:
    166
    if i want to run chkservd every 5 minute which part of the script i should edit?

    is it "sleep(500);" on line 107 ?

    thank you
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
    #5 markhard, Sep 9, 2004
    Last edited: Sep 9, 2004
  6. PWSowner

    PWSowner Well-Known Member

    Joined:
    Nov 10, 2001
    Messages:
    2,948
    Likes Received:
    4
    Trophy Points:
    343
    Location:
    ON, Canada
    That's what you would change, but it will be overwritten with updates, plus, 500 seconds is 8 min and 20 sec, which isn't much longer than 5 minutes, so why change it.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  7. chirpy

    chirpy Well-Known Member

    Joined:
    Jun 15, 2002
    Messages:
    13,460
    Likes Received:
    22
    Trophy Points:
    463
    Location:
    Go on, have a guess
    Well, it's actually 8 min and 33.33 sec and could make all the difference :p
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  8. SarcNBit

    SarcNBit Well-Known Member

    Joined:
    Oct 14, 2003
    Messages:
    1,010
    Likes Received:
    3
    Trophy Points:
    168
    /me thinks chirpy needs to check his math :p

    It is 8.33 minutes, but it is still 8 minutes and 20 seconds. 20 seconds = .3333 minutes ;)

    Damn base 60!
     
  9. chirpy

    chirpy Well-Known Member

    Joined:
    Jun 15, 2002
    Messages:
    13,460
    Likes Received:
    22
    Trophy Points:
    463
    Location:
    Go on, have a guess
    Oh. Yeah. Oops. Long day. Now, where's that edit post button :eek:
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  10. PWSowner

    PWSowner Well-Known Member

    Joined:
    Nov 10, 2001
    Messages:
    2,948
    Likes Received:
    4
    Trophy Points:
    343
    Location:
    ON, Canada
    When I read this one, I started thinking, "I am getting old", but then I recalculated, then read the next reply.

    I guess I'm not that old yet. ;)


    Yeah, when are they going to measure time in metric units? :D
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  11. SarcNBit

    SarcNBit Well-Known Member

    Joined:
    Oct 14, 2003
    Messages:
    1,010
    Likes Received:
    3
    Trophy Points:
    168
    BTDT <- Been there done that!

    Squirrel and I have you held hostage now with quotes. I am sure we can make the whole thing disappear for the right price. :cool: ;)
     
  12. PWSowner

    PWSowner Well-Known Member

    Joined:
    Nov 10, 2001
    Messages:
    2,948
    Likes Received:
    4
    Trophy Points:
    343
    Location:
    ON, Canada
    My price might be a bit high. ;)
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  13. markhard

    markhard Well-Known Member

    Joined:
    Apr 22, 2004
    Messages:
    250
    Likes Received:
    0
    Trophy Points:
    166
    some times cpsrvd failed when user login to cpanel, and of course waiting for 5 minutes is better than waiting 8 minutes before cpsrvd restared by chkservd :rolleyes:

    thanks for the answer :)
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
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