Installing WilyMail

Dry run

To test WilyMail, I'd suggest a test run with the default settings. A script called wily.sh in the wily directory of wily-1.0.tar runs WilyMail.

Dry run configuration

To actually run, wily.sh needs to know where its libraries and configuration files are, and where java is. It uses the variable WILY_HOME for this purpose. If you extracted wily-1.0.tar in /home/wilyUser then open up wily.sh and set WILY_HOME to /home/wilyUser/wily. You'll also need to set JAVA to the java executable on your system.

By default, wily.sh tells WilyMail to use the config file at $WILY_HOME/wilyConfig.xml. So, to tell WilyMail what mail server to use and to set other mail options, you should edit this file for your setup. Instructions on configuring WilyMail are here. It'd probably be wise to have WilyMail only notify you if a server has changed while testing it, so edit the recipients in the config file to point to your email address. Also, by default WilyMail waits 15 minutes to before checking on its results. This is fine for a cron job, but for our dry run I'd suggest setting the value to a hundreth of a minute.

Actually running the dry run

After setting WILY_HOME and changing wilyConfig.xml, run wily.sh. Since $WILY_HOME/wilyConfig.xml is optimistic, all the connections in it have their lastStatus set to SUCCESSFUL. With a minutesToWait value of .01, unless we're seeing particularly blazing performance from the servers today an email will show up at the address you specified in the recipient elements. The http and name servers can respond in that amount of time, but everything else will still have a status of TRYING. The email you get should indicate this. If there were any problems and WilyMail was unable to run for some reason (couldn't find the config file, couldn't talk to the smtp server you specified) it will print the problem out to System.err. If it did complete successfully, there should be a log file with WilyMail's normal output at $WILY_HOME/logs/[runtime/wilyMail.log and a copy of the original config file with updated status messages at $WILY_HOME/wily.lastStatus.xml. WilyMail will use this lastStatus file to get the previous server status, so if you run wily.sh again you shouldn't receive another email.

Editing wily.sh

wily.sh keeps all of the variables it needs to run inside of it to make it easy to run as a cron job. To change the default config file wily.sh uses, or to change where it puts its log files or its updated config file, you need to edit wily.sh. There are several variables near the top of wily.sh that configure its output location.

  • JAVA - The location of the java executable on your system
  • CONFIG - determines the config file WilyMail uses
  • LOG - determines where WilyMail writes its log files
  • UPDATED_CONFIG - determines where WilyMail stores its updated config

I would recommend using absolute paths for each of these since WilyMail will likely be run from cron

Querying other servers

WilyMail queries every server it has a connection element for in its config file. To make it query another server, just edit the config file used in wily.sh as explained here.

Adding WilyMail to cron

At USC, we have an entry in our crontab that looks like this:

0,30 * * * * /home/wilyUser/wily/wily.sh
This will run WilyMail every 30 minutes using the settings in wily.sh to determine which config file to use and where to write logs. Since WilyMail is going to wait a long time between executions, I'd set the minutesToWait in the config file to be something like 15 minutes. This will give even the tardiest of servers time to get some results, and ensure that you're getting email for servers that are really down. The UPDATED_CONFIG and LOG locations should be writable by cron or WilyMail will not be able to update the status of servers between runs.