Last active
February 26, 2016 19:05
-
-
Save MikeDacre/10ae23dcd3986793c3fd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#SBATCH --partition=<partition> | |
#SBATCH --time=00:02:00 | |
#SBATCH --nodes=1 | |
#SBATCH --ntasks-per-node=1 | |
#SBATCH --signal=b:USR1@10 | |
trap_with_arg() { | |
func="$1" ; shift | |
for sig ; do | |
trap "$func $sig" "$sig" | |
done | |
} | |
func_trap() { | |
echo Trapped: $1 | |
} | |
trap_with_arg func_trap 0 1 USR1 EXIT HUP INT QUIT PIPE TERM | |
cat /dev/zero > /dev/null & | |
wait |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment