When running a bash script on a local machine, one can use bash -x script.sh
to run it in debug mode.
Is it possible with sbatch script.sh
to specify a parameter in order to also run the script in debug mode on a cluster?
I couldn't find a hint for such a debug mode in the man pages for sbatch.
As the user Poshi suggested, I added the option set -x
to the beginning of my script and now the bash script is run in debug mode.
#!/bin/bash
set -x
#SBATCH --nodes=1
#SBATCH --ntasks-per-node 1
#SBATCH --mem=1GB
#SBATCH --partition normal
#SBATCH --time=00:01:00
#SBATCH --mail-type=FAIL,TIME_LIMIT
HELLO="hello there"
echo $HELLO
The slurm output file now looks like this:
cat *out
+ HELLO='hello there'
+ echo hello there
hello there
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.