#!/bin/bash
######################################################################
# ugcancel 0.1
#-------------------------------------------------------------------
# created by Martin Rupp 05.03.2012
######################################################################

# set default values
scriptname=$0;		  # name of script
scriptpath=`dirname $scriptname`

echo "ugcancel 0.1. (c) Goethe-Center for Scientific Computing 2012-2014"

######################################################################

function usage 
{
	echo ""
    echo " usage:  "$scriptname" <jobid> [-cluster <clustertype>]..."
	echo " "
	echo "        <jobid>                : jobib (use uginfo to get a jobid)"
	echo ""
    exit 0;
}

# check that at least 2 args given, else print usage
if [ $# -lt 1 ]; then
   usage
fi

jobid=$1;            # number of nodes
shift

while [  $# -gt 0 ]
do
	if [ $1 = "-cluster" ]; then
		UGSUBMIT_TYPE=$2
		shift 2
	else
		break
	fi
done

source $scriptpath/clusters

UJS_Cancel $jobid



