Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /hermes/bosweb/web234/b2344/sl.harringtonweb/public_html/pmwiki2.php:2) in /hermes/bosweb/web234/b2344/sl.harringtonweb/public_html/pmwiki2.php on line 1570

Warning: Cannot modify header information - headers already sent by (output started at /hermes/bosweb/web234/b2344/sl.harringtonweb/public_html/pmwiki2.php:2) in /hermes/bosweb/web234/b2344/sl.harringtonweb/public_html/pub/skins/simple/simple.php on line 39

Warning: Cannot modify header information - headers already sent by (output started at /hermes/bosweb/web234/b2344/sl.harringtonweb/public_html/pmwiki2.php:2) in /hermes/bosweb/web234/b2344/sl.harringtonweb/public_html/pmwiki2.php on line 866
Harrington Web : Brian - Web Check

Home > Projects > Web Check


I occasionally have problems with the power or with a machine that causes the web server on the machine to be inaccessible. This program was written to regularly check the sites that I administer. The program checks a set of URL's to ensure that it can connect and download the content. A report is generated that gives the status, either "ok" or the message from the exception, of each URL, and the report is sent to me via email. I use cron to run the program at the desired interval.

Example

To use the program you must first setup a configuration file. The first part provides the information needed to send the report:

to           = you@yourdomain.com
from         = you@yourdomain.com
subject      = Website Status Report
mail_server  = cs.unt.edu

The second part provides a list of URL's to visit. The protocol specifier will be added automatically. Any number of sites can be checked. It will loop through the sites starting with site_0 and will keep going until there is no key site_n. A sample properties file is available in the downloads section.

site_0       = www.yourdomain.com
site_1       = www.yourdomain.com:8080
site_2       = www.someotherdomain.com

To run:

  1. Set the classpath with the program itself and the jar files for Commons Email, JavaMail, and the Activation Framework.
  2. Run the program with the path to the configuration file as the only parameter.

If everything is in the current working directory the command would look like:

shell$ export CLASSPATH=./:commons-email.jar:javamail.jar:activation.jar
shell$ java SiteCheck sample.properties

Third Party Libraries

Download

 
Page last modified on June 28, 2006, at 07:31 PM.