#!/bin/sh
#---------------------------------------------------------------------
#     Copyright (C) GFD Dennou Club, 2005. All rights reserved.
#---------------------------------------------------------------------
#= Shell Script for Run DCPAM-APE
#
# * Developers:: Yasuhiro MORIKAWA, Yamada Yukiko
# * Version:: $Id: dcpam_ape.sh,v 1.1 2005/11/29 15:19:18 yukiko Exp $
# * Tag Name:: $Name: dcpam3-20060725 $
# * Change History::
# 

PROGRAM=../bin/dcpam_ape

RM=rm
SAVELOG=/usr/bin/savelog

OUTPUT=result.nc
LOGFILE=dcpam_ape.log
MSGFILE=dcpam_ape.msg
NMLFILE=dcpam_ape.nml

if [ -x $SAVELOG ] ; then
    if [ -f $OUTPUT ] ; then
	$SAVELOG $OUTPUT
    fi
    if [ -f $LOGFILE ] ; then
	$SAVELOG $LOGFILE
    fi
else
    if [ -f $OUTPUT ] ; then
	$RM $OUTPUT
	echo "remove $OUTPUT"
    fi
    if [ -f $LOGFILE ] ; then
	$RM $LOGFILE
	echo "remove $LOGFILE"
    fi
fi

if [ ! -f $PROGRAM ] ; then 
    echo "$PROGRAM is not found."
    exit 1
elif [ ! -f $NMLFILE ] ; then
    echo "$NMLFILE is not found."
    exit 1
else 
    $PROGRAM 2> $LOGFILE # 1> $MSGFILE
#    $PROGRAM < $NMLFILE 1 > $LOGFILE 2>& 1
    exit 0
fi





