-
Notifications
You must be signed in to change notification settings - Fork 2
/
batch_runEIC_5on41.sh
executable file
·37 lines (34 loc) · 1.92 KB
/
batch_runEIC_5on41.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#! /bin/bash
# Batch submission job script, executes run_EIC_batch.csh script
echo "Running as ${USER}" # Checks who you're running this as
NumFiles=$1
NumEvents=$2
##Output history file##
historyfile=hist.$( date "+%Y-%m-%d_%H-%M-%S" ).log # Creates a log file
##Output batch script##
auger="augerID.tmp"
i=1
while [[ $i -le $NumFiles ]]; do
batch="${USER}_EICDempGen_5on41_${i}_Job.txt" # The name of the job submission script it'll create each time
echo "Running ${batch} for file ${i}"
cp /dev/null ${batch}
RandomSeed=$(od -An -N3 -i /dev/random)
echo "#!/bin/csh" >> ${batch} # Tells your job which shell to run in
echo "#PBS -N DEMPGen_5on41_${NumEvents}_${i}" >> ${batch} # Name your job
echo "#PBS -m abe" >> ${batch} # Email you on job start, end or error
#echo "#PBS -M ${USER}@jlab.org" >>${batch} # Your email address, change it to be what you like
echo "#PBS -r n" >> ${batch} # Don't re-run if it crashes
echo "#PBS -o /home/${USER}/trq_output/DEMPGen_5on41_${NumEvents}_${i}.out" >> ${batch} # Output directory and file name, set to what you like
echo "#PBS -e /home/${USER}/trq_output/DEMPGen_5on41_${NumEvents}_${i}.err" >> ${batch} # Error output directory and file name
echo "date" >> ${batch}
echo "cd /home/apps/DEMPgen/" >> ${batch} # Tell your job to go to the directory with the script you want to run
echo "./run_EIC_batch_5on41.csh ${i} ${NumEvents} ${RandomSeed}" >> ${batch} # Run your script, change this to what you like
echo "date">>${batch}
echo "exit">>${batch} # End of your job script
echo "Submitting batch"
eval "qsub ${batch} 2>/dev/null" # Use qsub to actually submit your job
echo " "
i=$(( $i + 1 ))
sleep 2
rm ${batch}
done