#!/bin/sh
#                         +----------------------------------+
#                         | shell script for running         |
#                         | sieglinde                        |
#                         +----------------------------------+

# Sieglinde directory
SIEGLINDE=/home/csong/bin/sieglinde

if [ $# -ne 2 ] ; then
    echo "usage: $0 inputfile outputfile"
    exit
fi

INPUT_FILE=$1
OUTPUT_FILE=$2

if [ ! -f $INPUT_FILE ] ; then
    echo inputfile $INPUT_FILE does not exist
    exit
fi


if [ -f $OUTPUT_FILE ] ; then
    echo outputfile $OUTPUT_FILE already exists
    exit
fi

touch $OUTPUT_FILE
if [ ! -f $OUTPUT_FILE ] ; then
    echo outputfile $OUTPUT_FILE can not be created
    exit
fi

if [ ! -x $SIEGLINDE ] ; then
    echo sieglinde program $SIEGLINDE not findable
    exit
fi

/bin/rm -f $OUTPUT_FILE

$SIEGLINDE -S calibrate.L1 \
           -t monsdb -D dbs1.amanda.wisc.edu \
           -I $INPUT_FILE \
           -F calout.$OUTPUT_FILE
