~adigitoleo/geobits

ba09dbe2c0cf52f0968bc0ac451b07772a5a3454 — adigitoleo a month ago b801c50
feat: Add job submission tool that automatically writes reffiles
1 files changed, 16 insertions(+), 0 deletions(-)

A tools/q,sub.sh
A tools/q,sub.sh => tools/q,sub.sh +16 -0
@@ 0,0 1,16 @@
#!/bin/sh
readonly SCRIPTNAME="${0##*/}"
set -eu
helpf() { echo 'q,sub <JOBSCRIPT> -- submit PBS job defined in JOBSCRIPT and write ID to a file in $HOME/refs/'; }
is_command() {
    if 1>/dev/null 2>&1 command -v "$1"; then
        return 0
    else
        >&2 printf '%s\n' "$SCRIPTNAME: command '$1' not found"; return 1
    fi
}

[ $# -eq 0 ] && { helpf; exit 1; }
[ "$1" = "-h" ] && { helpf; exit 1; }
is_command qsub || exit 1
qsub "$1" >~/refs/"{$1%%.sh}.ref"