#! /bin/sh -f

# string	stands for			Globus context meaning
# --------------------------------------------------------------------
# Q		Queued				PENDING
# S		Suspended (Unicos only)		SUSPENDED
# W		Waiting for delayed exection  	PENDING
# H		Held 				SUSPENDED
# T		Being moved to new location	PENDING
# R		Running 			ACTIVE
# E		Exiting after having run	ACTIVE
#
. ${GLOBUS_LOCATION}/libexec/globus-script-initializer

globus_source ${libexecdir}/globus-gram-protocol-constants.sh
globus_source ${libexecdir}/globus-sh-tools.sh
globus_source ${libexecdir}/globus-gram-job-manager-tools.sh

grep=${GLOBUS_SH_GREP-grep}
awk=${GLOBUS_SH_AWK-awk}


arg_file=$1

        # Check for the argument file. If it does not exist
        # then return with an error immediately

if [ ! -f $arg_file ] ; then
   echo GRAM_SCRIPT_ERROR:$GLOBUS_GRAM_PROTOCOL_ERROR_BAD_SCRIPT_ARG_FILE
   exit 1
fi

        # Source the argument file to set environment variables
        # defining all the job arguments

. $arg_file

        # If a logfile name has been defined then activate debug mode

if [ $grami_logfile = "/dev/null" ] ; then
    DEBUG_ECHO=:
else
    DEBUG_ECHO=echo
fi

$DEBUG_ECHO in gram_script_ng_poll >> $grami_logfile
$DEBUG_ECHO ng doe not support poll in that way: $grami_job_id >> $grami_logfile

	# Return appropriate job status
gram_job_state=$GLOBUS_GRAM_PROTOCOL_JOB_STATE_DONE
$DEBUG_ECHO "returning success, job state: $gram_job_state" >> $grami_logfile
echo "GRAM_SCRIPT_SUCCESS:$gram_job_state"

$DEBUG_ECHO "exiting gram_script_ng_poll\n\n" >> $grami_logfile

exit
