O'Reilly Forums: Cron To Check That Domains Are Running - O'Reilly Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Cron To Check That Domains Are Running

#1 User is offline   amssb 

  • New Member
  • Pip
  • Group: Members
  • Posts: 1
  • Joined: 25-July 09

Posted 25 July 2009 - 08:59 AM

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
0

#2 User is offline   noahgift 

  • New Member
  • Pip
  • Group: Members
  • Posts: 5
  • Joined: 24-June 08

Posted 04 September 2010 - 06:35 PM

QUOTE (amssb @ Jul 25 2009, 12:59 PM) <{POST_SNAPBACK}>
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



Sorin,

Sure, there are a bunch of different ways to do this. Here is one easy way off the top of my head. Write a functional test using webtest, or twill that "asserts" some unique property of your domains. You could then run a cron every 15 minutes, or hour, depending on how much you care if your site is down, and put logic inside that restarts apache if your functional test fails.

In sudo code it would look like this:

try:
functional_test()
except AssertionError:
print "True"






Here is a article I wrote that has some more information about functional testing:

http://www.ibm.com/developerworks/web/library/wa-aj-testing/






0

#3 User is offline   kellylummus 

  • New Member
  • Pip
  • Group: Members
  • Posts: 1
  • Joined: 11-October 10

Posted 12 October 2010 - 12:01 AM

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.domain X.com in the browser) that my domains did not work and I had to restart Apache using my root privileges.


____________
VLC Download

0

#4 User is offline   t onroed 

  • New Member
  • Pip
  • Group: Members
  • Posts: 1
  • Joined: 17-May 12
  • Gender:Male

Posted 17 May 2012 - 11:08 AM

Have you checked the error log to see if there are some problems? Or maybe there are problems with some module crashing. Check your config too.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users