diff --git a/sinline b/sinline index a76744a..7564a19 100755 --- a/sinline +++ b/sinline @@ -69,12 +69,18 @@ if [ -z "${sbatch_args}" ]; then sbatch_args="--time=00:30:00" fi -echo '#!/bin/bash' > /tmp/bash_script.sh -echo '#SBATCH -o sbatch_stdout.log' >> /tmp/bash_script.sh -echo '#SBATCH -e sbatch_stderr.log' >> /tmp/bash_script.sh -echo "${cmd}" >> /tmp/bash_script.sh +dt=$(date '+%d_%m_%Y__%H_%M_%S') +uname=$(whoami) +TMPFILEPATH=/tmp/bash_script_${uname}_${dt}.sh -sbatch --wait ${sbatch_args} -w ${node} /tmp/bash_script.sh + +echo '#!/bin/bash' > ${TMPFILEPATH} +echo '#SBATCH -o sbatch_stdout.log' >> ${TMPFILEPATH} +echo '#SBATCH -e sbatch_stderr.log' >> ${TMPFILEPATH} +echo "${cmd}" >> ${TMPFILEPATH} +chmod u+x ${TMPFILEPATH} # make sure it is executable + +sbatch --wait ${sbatch_args} -w ${node} ${TMPFILEPATH} wait cat sbatch_stdout.log >&1 @@ -83,5 +89,5 @@ cat sbatch_stderr.log >&2 # Clean up if [ "${cleanup}" -eq "1" ]; then rm sbatch_std{out,err}.log - rm /tmp/bash_script.sh + rm ${TMPFILEPATH} fi