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.

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:
    1
    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,475
    Likes Received:
    20
    Trophy Points:
    38
    Location:
    Go on, have a guess
    One already exists for cPanel - chkservd
     
  3. beachtrader

    beachtrader Active Member

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

    Can it be changed?
     
  4. chirpy

    chirpy Well-Known Member

    Joined:
    Jun 15, 2002
    Messages:
    13,475
    Likes Received:
    20
    Trophy Points:
    38
    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.
     
  5. markhard

    markhard Well-Known Member

    Joined:
    Apr 22, 2004
    Messages:
    250
    Likes Received:
    0
    Trophy Points:
    16
    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
     
    #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:
    3
    Trophy Points:
    38
    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.
     
  7. chirpy

    chirpy Well-Known Member

    Joined:
    Jun 15, 2002
    Messages:
    13,475
    Likes Received:
    20
    Trophy Points:
    38
    Location:
    Go on, have a guess
    Well, it's actually 8 min and 33.33 sec and could make all the difference :p
     
  8. SarcNBit

    SarcNBit Well-Known Member

    Joined:
    Oct 14, 2003
    Messages:
    1,010
    Likes Received:
    3
    Trophy Points:
    38
    /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,475
    Likes Received:
    20
    Trophy Points:
    38
    Location:
    Go on, have a guess
    Oh. Yeah. Oops. Long day. Now, where's that edit post button :eek:
     
  10. PWSowner

    PWSowner Well-Known Member

    Joined:
    Nov 10, 2001
    Messages:
    2,948
    Likes Received:
    3
    Trophy Points:
    38
    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
     
  11. SarcNBit

    SarcNBit Well-Known Member

    Joined:
    Oct 14, 2003
    Messages:
    1,010
    Likes Received:
    3
    Trophy Points:
    38
    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:
    3
    Trophy Points:
    38
    Location:
    ON, Canada
    My price might be a bit high. ;)
     
  13. markhard

    markhard Well-Known Member

    Joined:
    Apr 22, 2004
    Messages:
    250
    Likes Received:
    0
    Trophy Points:
    16
    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 :)
     
Loading...

Share This Page