#!/bin/sh
################################################################################
#
# Copyright (c) 2001-2003 Tortuga Technologies Pty Ltd. All rights reserved.
#
# This is unpublished proprietary source code of Tortuga Technologies Pty Ltd.
# The copyright notice above does not evidence any actual or intended
# publication of such source code.
#
################################################################################
#
# File:        reports.sh
#
# Description: Run an Ozibug report and mail it to a friend
#
# Synopsis:    reports.sh  report_name  recipient_email_address
#              reports.sh  report_name  recipient_name  recipient_email_address
#
# Examples:    reports.sh  Default eric@ozibug.com            
#              reports.sh  All%20New "Eric Ozibug" eric@ozibug.com            
#
# Parameters:                                                 
#
# ${1} - Ozibug report name, space characters should be changed to %20 as in All%20New
# ${2} - Mail recipient name, pass in as a quoted value ie., "Fred Jones"
# ${3} - Mail recipient address
#
################################################################################

#
# Set to where your JDK is installed
#
JAVA_HOME="/opt/jdk"
export JAVA_HOME

#
# Set to where your ANT package is installed
#
ANT_HOME="/opt/jakarta-ant"
export ANT_HOME

#
# You must have these jars for ANT to be able to mail
#
CLASSPATH="/opt/javamail/mail.jar:/opt/jaf/activation.jar"
export CLASSPATH

#
# setup the PATH for Java and ANT
#
PATH="${ANT_HOME}/bin:${JAVA_HOME}/bin:${PATH}"
export PATH

#
# setup the ANT target to execute
#
ANT_COMMAND="ozibug.report"
export ANT_COMMAND

#
# and do it
#
if [ -n "${3}" ]; then
  #echo ant "-Dreport.name=${1}" "-Dto.name=${2}" "-Dto.address=${3}" ${ANT_COMMAND}
  ant "-Dreport.name=${1}" "-Dto.name=${2}" "-Dto.address=${3}" ${ANT_COMMAND}
else
  #echo ant "-Dreport.name=${1}" "-Dto.name=" "-Dto.address=${2}" ${ANT_COMMAND}
  ant "-Dreport.name=${1}" "-Dto.name=" "-Dto.address=${2}" ${ANT_COMMAND}
fi

exit $?

