#!/bin/bash
#
#help
# Syntax:   runSetConfig jarfile [options] 
# Function: Run MASetConfig from the MailArchive jar file.
#           The jar and support jar files must be in /usr/java/jarlib
#           If 'jarfile' can't be found it will be skipped and 
#           a warning output.
# Options:  See MASetConfig documentation
#end

if [ "$1" == '--help' -o "$1" == '-?' ]
then
	script_help runSetConfig
	exit 0
fi

if [ -z "$1" ]
then
	echo "Error: no jarfile name supplied"
	exit 1
fi
if [ -f "$1" ]
then
	if [ -f ma/MailArchive.class ]
	then
		launcher=ma/MailArchive
	else
		launcher="-jar /usr/java/jarlib/MailArchive.jar"
	fi

	MEM=450m
	if [ $# -eq 0 ]
	then
		java -Xmx$MEM $launcher MASetConfig 
	else
		java -Xmx$MEM $launcher MASetConfig $*
	fi
else
	echo "$1 not found: skipped"
fi
