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/