Cron to check that domains are running.

Discussion in 'Apache' started by amssb, Jul 25, 2009.

  1. #1
    Hi,

    I have a dedicated server (lamp & cpanel) under which I host different web domains:
    www.domain1.com, www.domain2.com, www.domain3.com, www.domain4.com, ...

    I'm upset because sometimes (rarely, though) I discovered (by opening www.domainX.com in the browser) that my domains did not work and I had to restart apache using my root privileges.

    Do you have any idea how can I automatically check if such a situation occurs again? A cron job or something like that?

    Thanks a lot for your time,
    Sorin
     
    amssb, Jul 25, 2009 IP
  2. rhewitt

    rhewitt Member

    Messages:
    113
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    30
    #2
    You could set up a cron job to ping the domains required or something similar. If the ping fails to resolve the host then you could have an email sent to you.

    This wont help if the apache server is running and something else has gone wrong though. If you want me to work on such a script PM me back. I'll quickly conjure one up and send it over :)
     
    rhewitt, Jul 26, 2009 IP
  3. thuankkk

    thuankkk Active Member

    Messages:
    503
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    95
    #3
    If your apache is running well, your domains will be ok.
    If you found that your site down (and restart apache makes it work), that means that there's some problem with apache. You can check the error logs to see what happen.

    Or, see Automatic start Apache when it died/down!
     
    thuankkk, Jul 26, 2009 IP