#$ -wd /tmp #$ -j y # Number of subtasks to start #$ -t 1-1 set -xv # Check if the number of parameters is correct if [ $# -ne 5 ]; then if [ $# -ne 6 ]; then echo "The number of arguments is not correct" echo "Please call the script with the following parameters" echo "Projectile (p,C,Co, Au, Pb)" echo "Target (p,C,Co, Au, Pb)" echo "beam kinetic energy" echo "centrality (centr/mbias)" echo "number of events" echo "Optional argument a file with a input fie list" exit 1 fi fi # read and transform all input parameters proj=$(echo $1 | tr '[A-Z]' '[a-z]') targ=$(echo $2 | tr '[A-Z]' '[a-z]') elb=$3 trig=$(echo $4 | tr '[A-Z]' '[a-z]') nev=$5 if [ $# -eq 5 ]; then # SGE_TASK_ID=1 # counter=$(printf "%05d" "1") counter=$SGE_TASK_ID counter5=$(printf "%05d" "$SGE_TASK_ID") seed_offset=0 else # counter=$(sed -n -e "1 p" $6) counter=$(sed -n -e "$SGE_TASK_ID p" $6) counter5=$(printf "%05d" "$counter") seed_offset=1100250 fi seed=$(($SGE_TASK_ID+$seed_offset)) # create special and enter special workdir for job username=$(whoami) workdir=/tmp/$username/$JOB_ID.$SGE_TASK_ID mkdir -p $workdir cd $workdir # setup filenames and directories fname="urqmd.$proj$targ.${elb}gev.$trig.$counter5" rootfile="${fname}.root" logfile="${fname}.log" _target=/hera/cbm/prod/gen/urqmd/$proj$targ/${elb}gev/$trig/ seedfile=$_target/log/SeedFile.txt #create the needed directories mkdir -p $_target/log # create some debug output START=$(date +%s) HOST=$(hostname) echo "Skript starts at $START on $HOST" # setup the run environment source /cvmfs/fairroot.gsi.de/cbm/bin/setup_urqmd.sh # run the urqmd production /cvmfs/fairroot.gsi.de/cbm/bin/run_urqmd.sh $proj $targ $elb $trig $nev $counter $seed $seedfile STOP=$(date +%s) DIFF=$(( $STOP - $START )) echo "Skript stops at $STOP" echo "Total runtime: $DIFF s" pwd ls -la # validate the root file /cvmfs/fairroot.gsi.de/cbm/bin/validate_root_file.sh $rootfile $nev result=$? if [ "$result" = "0" ]; then # Copy results to final destination mv -v $rootfile $_target echo "$rootfile:Ok" >> $_target/log/Correct_files_$JOB_ID.log rm -rf $workdir else mv -v $logfile $_target/log # Evacuate the GE log-file mv -v $SGE_STDOUT_PATH $_target/log/$JOB_ID.$SGE_TASK_ID.log echo "$rootfile:Error" >> $_target/log/Error_files_$JOB_ID.log fi