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.

CPPOP WENT DOWN... Automatic check on this???

Discussion in 'General Discussion' started by nitromax, Sep 25, 2002.

  1. nitromax

    nitromax Well-Known Member

    Joined:
    Feb 12, 2002
    Messages:
    189
    Likes Received:
    0
    Trophy Points:
    16
    Does anyone know if there is a cron that checks to see if the pop3 server is running or not?

    If not does anyone know how I could implement that?


    Last night something happened and when I came into work I found out that the pop3 server was down, and no one could access their control panels. I restarted the pop3 server from the WHM, and I did this ( /etc/rc.d/init.d/cpanel3 restart ) via SSH command line and the control panels came back too.
     
  2. ecoutez

    ecoutez Well-Known Member

    Joined:
    May 23, 2002
    Messages:
    152
    Likes Received:
    0
    Trophy Points:
    0
    Sure. Chkserv.d can do this...

    Create a new file in /etc/chkserv.d/ - any name you like, but something like pop3 or cppop would make sense. Contents should look like:
    #SERVICE = PORT, SEND, RESPONSE, RESTART COMMAND
    service[pop3]=110,QUIT,+,/usr/local/cpanel/bin/cppop

    chown/chmod just as the other files in this directory (root.root, 600) and restart chkserv.d (/etc/rc.d/init.d/chkservd restart)

    - Jason
     
  3. ecoutez

    ecoutez Well-Known Member

    Joined:
    May 23, 2002
    Messages:
    152
    Likes Received:
    0
    Trophy Points:
    0
    As long as we're at it, here's what I use to check IMAPd:
    #SERVICE = PORT, SEND, RESPONSE, RESTART COMMAND
    service[imapd]=143,. LOGOUT,* OK,/etc/rc.d/init.d/xinetd start

    And for SSHd:
    #SERVICE = PORT, SEND, RESPONSE, RESTART COMMAND
    service[sshd]=22,QUIT,SSH-,/etc/rc.d/init.d/sshd start

    - Jason
     
  4. nitromax

    nitromax Well-Known Member

    Joined:
    Feb 12, 2002
    Messages:
    189
    Likes Received:
    0
    Trophy Points:
    16
    Thanks for the quick reply! It looks like chkservd was not even running. I will try your suggestions above.

    Sorry for a newbie question, but if I understand correctly chkservd runs in the backgroud at all times? How often does it check to make sure apache and the other services are up? Like if I manually kill apache how quickly will it take chkservd to get it back up? Does it check the services like every 1 minute or something?

    And what checks to make sure chkservd is running? hehe How would you do that?
     
  5. ecoutez

    ecoutez Well-Known Member

    Joined:
    May 23, 2002
    Messages:
    152
    Likes Received:
    0
    Trophy Points:
    0
    [quote:0d36f284b3][i:0d36f284b3]Originally posted by nitromax[/i:0d36f284b3]
    Sorry for a newbie question, but if I understand correctly chkservd runs in the backgroud at all times? How often does it check to make sure apache and the other services are up?
    [/quote:0d36f284b3]
    Yes... it should be running at all times, and seems to check services every 8 or 9 minutes. Take a look at your /var/log/chkservd.log to see when it made its checks.
    [quote:0d36f284b3]
    Like if I manually kill apache how quickly will it take chkservd to get it back up? Does it check the services like every 1 minute or something?
    [/quote:0d36f284b3]
    Figure 9 minutes or less - depends on where in the cycle it happens to be when you kill Apache. Because of that 8-9 minute interval, a service could be down for that long before being reported as down, and before a restart is attempted. And when chkservd does see a service down, it immediately reports it down and THEN attempts to restart it. As such, you will start getting a report about a down service at the same time that the situation is corrected. And then another 8-9 minutes later you'll see it reporting as up again.
    [quote:0d36f284b3]
    And what checks to make sure chkservd is running? hehe How would you do that?[/quote:0d36f284b3]
    I guess you could run a cron job every hour to make sure its running, or use some other service checking program.

    - Jason
     
  6. jsteel

    jsteel Well-Known Member

    Joined:
    Jul 4, 2002
    Messages:
    646
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Atlanta, GA
    It there a way to increase the frequency of the checks? 8-9 minutes is a pretty long time.

    Jaz
     
  7. dgbaker

    dgbaker Well-Known Member
    PartnerNOC

    Joined:
    Sep 20, 2002
    Messages:
    2,578
    Likes Received:
    3
    Trophy Points:
    38
    Location:
    Toronto, Ontario Canada
    For changing interval of checking.

    I found in /usr/sbin/chkservd there is a sleep 500 (8.33 minutes) on line 63. I've modifed mine to 180 (2 minutes) seems to be working fine. :)

    Nick or someone would have to make a permanant change or make this configurable.

    NOTE: Found issue with this. httpd connections get chewed up real fast and you will start to see http restarts on SIGUSR1.

    I wonder if that is why it was set to 8 minutes :p
     
  8. nitromax

    nitromax Well-Known Member

    Joined:
    Feb 12, 2002
    Messages:
    189
    Likes Received:
    0
    Trophy Points:
    16
    Thanks David, that works great! Although for me it said sleep(100) on line 63, so I searched for the sleep statement and found sleep(500) farther down in the script, just a few lines above the subroutine called notify.... shown below. But that seems to do the trick! I changed it to 120.

    print &Done\n&;
    sleep(120);
    }
    close(LOG);


    sub notify {
    my($subject,$body) = @_;


    I think everyone gets those SIGUSR1 restarts every 10 minutes. I still don't understand that issue.


    Thanks again!
     
  9. dgbaker

    dgbaker Well-Known Member
    PartnerNOC

    Joined:
    Sep 20, 2002
    Messages:
    2,578
    Likes Received:
    3
    Trophy Points:
    38
    Location:
    Toronto, Ontario Canada
    What's neat is that this version of apache 1.3.27 is supposed to have fixed that issue with SIGUSR1.
     
  10. nitromax

    nitromax Well-Known Member

    Joined:
    Feb 12, 2002
    Messages:
    189
    Likes Received:
    0
    Trophy Points:
    16
    Really? I just recompiled Apache lastnight using the /scripts/easyapache. I know that is 1.3.27. But I just did the following command and I'm still getting them every 10 minutes:


    grep &SIG& /usr/local/apache/logs/error_log | grep &Oct 29&

    Are yours gone?
     
  11. dgbaker

    dgbaker Well-Known Member
    PartnerNOC

    Joined:
    Sep 20, 2002
    Messages:
    2,578
    Likes Received:
    3
    Trophy Points:
    38
    Location:
    Toronto, Ontario Canada
    Nope. Still there..
     
  12. jamesbond

    jamesbond Well-Known Member

    Joined:
    Oct 9, 2002
    Messages:
    738
    Likes Received:
    1
    Trophy Points:
    18
    [quote:29a184fccc][i:29a184fccc]Originally posted by dgbaker[/i:29a184fccc]

    What's neat is that this version of apache 1.3.27 is supposed to have fixed that issue with SIGUSR1.[/quote:29a184fccc]

    Well I'm running Apache 1.3.27 and CPanel R56 and I have the SIGUSR1 message in the logs every 10 min as well.

    [Thu Nov 28 21:19:07 2002] [notice] SIGUSR1 received. Doing graceful restart
    [Thu Nov 28 21:29:07 2002] [notice] SIGUSR1 received. Doing graceful restart
    [Thu Nov 28 21:39:07 2002] [notice] SIGUSR1 received. Doing graceful restart
    [Thu Nov 28 21:49:07 2002] [notice] SIGUSR1 received. Doing graceful restart
    [Thu Nov 28 21:59:07 2002] [notice] SIGUSR1 received. Doing graceful restart
    [Thu Nov 28 22:09:12 2002] [notice] SIGUSR1 received. Doing graceful restart
     

Share This Page