You can use your computer to automatically execute
an Ozibug report and have it emailed to you.
When using Unix or Linux machines this is done
using the crontab and
cron commands.
When using Windows machines this is done
using the at command or
through the task scheduler utility.
The uses for being able to do this are endless.
You can get a summary of new bugs emailed to you
every Monday morning or perhaps you want to
schedule a nightly custom XML report and integrate
this into other XML aware products.
The following sections will take you through
the steps to schedule a report.
You will need some additional packages to be able
to schedule your reports. A Java installation,
the ANT package, and some additional common jars
from freely available software.
Java
This is the java execution environment.
It is probably already installed on your
computer and may either be the JDK or JRE.
If not it can be downloaded from
Sun Microsystems.
ANT
This is a Java build tool which is used to
run various combinations of tasks in a platform
independent manner.
It can be downloaded from the
ANT Apache
website.
JavaMail
This is a commonly used software library required
to enable the sending of email.
It can be downloaded from
Sun Microsystems.
JAF
This is a commonly used software library required
to enable the sending of email.
It can be downloaded from
Sun Microsystems.
Set this property to the port
of the server where your Ozibug
is located.
Note: this should
contain a leading colon if it is set.
If your port is the default (80)
then this property should have the value
of "".
<property name="port" value=":8080" />
context
Set this property to the context
of your Ozibug (this is usually
ozibug.)
<property name="context" value="ozibug" />
mailhost
Set this property to the fully
qualified address of your mailserver.
Set this property to the value of the
key parameter.
The authentication key can be obtained from the
key link
on the Maintain User page.
It is also displayed in the address
bar of your browser when you create a report
in Ozibug and then select the orange XML
button.
There is more information on this in the
Create an Ozibug report
section.
Download the reports.bat
file for Win32 platforms or
reports.sh for Linux
or Unix platforms.
Place the file into the reports directory and
open it in your favourite editor.
You'll need to edit the file to reflect your
configuration.
Win32 - reports.bat
JAVA_HOME
Set this variable to the directory where
you installed Java into.
set JAVA_HOME=C:\jdk1.3.1
ANT_HOME
Set this variable to the directory
where you installed ANT into.
set ANT_HOME=C:\jakarta-ant
CLASSPATH
Set this variable to include the jars of
the JavaMail and JAF packages.
set CLASSPATH=C:\javamail\mail.jar;C:\jaf\activation.jar
Linux/Unix - reports.sh
JAVA_HOME
Set this variable to the directory where
you installed Java into.
JAVA_HOME="/opt/jdk"
ANT_HOME
Set this variable to the directory
where you installed ANT into.
ANT_HOME="/opt/jakarta-ant"
CLASSPATH
Set this variable to include the jars of
the JavaMail and JAF packages.
Log into Ozibug as the user that you wish to run
the report as.
Now go to the reports page
and create your report
as normal and save it with a sensible name.
Once created you should verify the report
can be run normally and produces the required
results in your browser.
You can now select the RSS outputType and then
the orange XML button
which will give you an XML format of your report.
It should display in a separate browser window
and at the end of the URL you should be able to see
the key parameter.
You can use this parameter to set a property in the
build.xml file.
Simply cut and paste just the parameter value
into the file.
In the following example URL the key section that
you can cut and paste has been highlighted.
You can now schedule the report from the command line
or from the task scheduler.
The task scheduler
is the recommended way as it allows you to assign
the proper permissions and set a fine tuned schedule
for the report.
The parameters that can be specified to the reports.bat
script are as follows.
Ozibug report name, space characters should
be changed to %20 so the
report called All New would
become All%20New.
Mail recipient name, pass in as a quoted
value ie., "Fred Jones".
Note that this parameter
is optional.
Mail recipient address ie., fred@jones.com
Windows Platforms
From the command window you can now schedule the report
batch file to run using the at command.
You may wish to wrap the command line in another
batch file
to add additional directions such as working
directory or multiple reports, etc.
rem ****************************************************************************
rem *
rem * File: C:\reports\wrapper.bat
rem *
rem * Description: wrapper script for executing one or more reports
rem *
rem ****************************************************************************
rem *
rem * change to the correct drive
rem *
C:
rem *
rem * change to the correct directory
rem *
cd reports
rem *
rem * now execute the report commands
rem *
reports.bat Default "Fred Jones" fred@jones.com
reports.bat All%20New "Fred Jones" fred@jones.com
The script can now be scheduled as follows.
This command schedules the execution to occur
just one time at 5:30 PM.
C:\> at 17:30 C:\reports\wrapper.bat
Added a new job with job ID = 1
C:\> at
Status ID Day Time Command Line
-------------------------------------------------------------------------------
1 Today 5:30 PM C:\reports\wrapper.bat
C:\>
Linux and Unix Platforms
When using Linux or Unix the scheduling can be done
with the at or crontab
commands in a very similar manner to that described above.
First create a text crontab file which contains
your comands to schedule, it will look similar
to the following.
################################################################################
#
# File: ${HOME}/eric.crontabs
#
# Description: crontab file used to schedule events
#
#***************************************************************************
#
# schedule the Default report at 5 minutes past midnight every day
#
5 0 * * * /opt/reports/reports.sh Default "Fred Jones" fred@jones.com
#
# schedule the "All New" report every weekday morning at 7 AM
#
0 7 * * 1-5 /opt/reports/reports.sh All%20New "Fred Jones" fred@jones.com
Now you can add the commands in this file to
the scheduler with the following command.
$ crontab ${HOME}/eric.crontabs
To list your scheduled commands issue the
following command.
$ crontab -l
################################################################################
#
# File: ${HOME}/eric.crontabs
#
# Description: crontab file used to schedule events
#
################################################################################
#
# schedule the Default report at 5 minutes past midnight every day
#
5 0 * * * /opt/reports/reports.sh Default "Fred Jones" fred@jones.com
#
# schedule the "All New" report every weekday morning at 7 AM
#
0 7 * * 1-5 /opt/reports/reports.sh All%20New "Fred Jones" fred@jones.com