Sie sind auf Seite 1von 3

#!

/bin/bash

# Execute getopt

HEIGHT=15
WIDTH=60
CHOICE_HEIGHT=4
BACKTITLE="Select License Server"
TITLE="Mentat Launcher"
MENU="Choose one of the following options:"

OPTIONS=(1 "MSC One license server (INDUX20)"


2 "Master Key license server (INDUX19)")

CHOICE=$(dialog --clear \
--backtitle "$BACKTITLE" \
--title "$TITLE" \
--menu "$MENU" \
$HEIGHT $WIDTH $CHOICE_HEIGHT \
"${OPTIONS[@]}" \
2>&1 >/dev/tty)

clear

case $CHOICE in
1)
LIC_SERVER="27500@indux20"
;;
2)
LIC_SERVER="27500@indux19"
;;
esac

sed -i "/MSC/d" ~/.bashrc


echo "unset MSC_LICENSE_FILE" >> ~/.bashrc
echo "export MSC_LICENSE_FILE=$LIC_SERVER" >> ~/.bashrc

#cat ~/.bashrc
echo $LIC_SERVER

# File name
readonly PROGNAME=$(basename $0)
# File name, without the extension
readonly PROGBASENAME=${PROGNAME%.*}
# File directory
readonly PROGDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
# Arguments
readonly VARARGS="$@"
# Arguments number
readonly ARGNUM="$#"

#read -e -p "Enter the job name for option -j : " jused


#read -e -p "Enter the number of cores for option -nprocd : " nprocdused
usage() {
echo "Script description"
echo
echo "Usage: $PROGNAME <jid> <nprocd>"
echo
}

if [ $# -eq 0 ]; then
usage
exit 0
fi
jused=$1
nprocdused=$2

# Marc Sge launcher script


read -e -p "Please Enter other options for this job which are compatible with
marc_run: " options_other
options=" -j $jused -nprocd $nprocdused -b no -v no "

options+=" $options_other"
echo "Options used for thi job are as below"
echo $options

case $nprocdused in
1) lic=160 ;;
2) lic=$(echo "scale=2; 200 / 2" | bc) ;;
3) lic=$(echo "scale=2; 225 / 3" | bc) ;;
4) lic=$(echo "scale=2; 250 / 4" | bc) ;;
5) lic=$(echo "scale=2; 265 / 5" | bc) ;;
6) lic=$(echo "scale=2; 280 / 6" | bc) ;;
7) lic=$(echo "scale=2; 295 / 7" | bc) ;;
8) lic=$(echo "scale=2; 310 / 8" | bc) ;;
esac

#oldlic=$lic
#
#read -p "Please enter number of CAMPUS licenses required: Current value is $lic :
" lic
#
#if [ -z "$lic" ]; then
#lic=$oldlic
#fi

#if [ "$nprocdused" -lt 4 ] ; then


#nprocdused=4
#else
#nprocdused=$(( *2 ))
#fi

exec 3>&1 >marc_job_submit_script.sh


echo "#!/bin/bash"
echo "#$ -N MARCJOB"
echo "#$ -cwd"
echo "#$ -q all.q"
echo "#$ -S /bin/bash"
echo '#$ -e err.$JOB_ID.$JOB_NAME'
echo '#$ -o out.$JOB_ID.$JOB_NAME'
echo "#$ -pe make `echo $nprocdused`"
echo "#$ -l CAMPUS=`echo $lic`"
echo "#$ -V"
echo
echo
echo "/opt/apps/msc_apps/marc2016/marc2016/tools/run_marc $options"

exec >&3-

read -p "Do you want to select compute node for this job (y/n)?" nodeyes
if [ "$nodeyes" == "y" ]; then

echo "please select from the below list of nodes:"


sleep 1
/usr/bin/check_nodes_au

read -p "Enter the name of the node:" nodename

echo "Submitting the job"


qsub -q all.q@$nodename marc_job_submit_script.sh

else
echo "Submitting the job"
qsub marc_job_submit_script.sh

fi

Das könnte Ihnen auch gefallen