#!/bin/sh

trap "/bin/rm -f ${BATCH_HOME}/Batch$$.log" EXIT

cd ${BATCH_HOME}
. ${BATCH_HOME}/sh/classpath.sh

execute() {
    # Pre Process
    ${JAVA_HOME}/bin/java batch.BatchStatus -start $*
    if [ $? -ne 0 ]; then
        return
    fi

    # Process
    ${JAVA_HOME}/bin/java  Batch $*
    if [ $? -ne 0 ]; then
        return
    fi
}
execute $* 2>> ${BATCH_HOME}/Batch$$.log

# Post Process
${JAVA_HOME}/bin/java batch.BatchStatus -end $* 2>> ${BATCH_HOME}/Batch$$.log

exit $?
