~adigitoleo/geobits

0778510e9838c9288c5538c1bd50eee291165fce — adigitoleo 8 months ago 2eb4c5a
fix: Add SCRIPTNAME
2 files changed, 8 insertions(+), 8 deletions(-)

M tools/q,del.sh
M tools/q,stat.sh
M tools/q,del.sh => tools/q,del.sh +4 -4
@@ 1,16 1,16 @@
#!/bin/sh
readonly SCRIPTNAME="${0##*/}"
set -eu
helpf() { echo 'q,del <REFFILE> -- delete/abort PBS job using ID read from REFFILE'; }
helpf() { echo 'q,del <REFFILE> -- delete/abort PBS job using ID stored in REFFILE'; }
is_command() {
    if 1>/dev/null 2>&1 command -v "$1"; then
        return 0
    else
        >&2 printf '%s\n' "command '$1' not found"; return 1
        >&2 printf '%s\n' "$SCRIPTNAME: command '$1' not found"; return 1
    fi
}
warn() { >&2 printf '%s\n' "$SCRIPTNAME: $1"; }
is_command qdel || { warn 'missing required executable: qdel'; exit 1; }

[ $# -eq 0 ] && { helpf; exit 1; }
[ "$1" = "-h" ] && { helpf; exit 1; }
is_command qdel || exit 1
qdel "$(cat "$1")"

M tools/q,stat.sh => tools/q,stat.sh +4 -4
@@ 1,16 1,16 @@
#!/bin/sh
readonly SCRIPTNAME="${0##*/}"
set -eu
helpf() { echo 'q,stat <REFFILE> -- show PBS job status of job ID read from REFFILE'; }
helpf() { echo 'q,stat <REFFILE> -- show PBS job status of job ID stored in REFFILE'; }
is_command() {
    if 1>/dev/null 2>&1 command -v "$1"; then
        return 0
    else
        >&2 printf '%s\n' "command '$1' not found"; return 1
        >&2 printf '%s\n' "$SCRIPTNAME: command '$1' not found"; return 1
    fi
}
warn() { >&2 printf '%s\n' "$SCRIPTNAME: $1"; }
is_command qstat || { warn 'missing required executable: qstat'; exit 1; }

[ $# -eq 0 ] && { helpf; exit 1; }
[ "$1" = "-h" ] && { helpf; exit 1; }
is_command qstat || exit 1
qstat -s1x "$(cat "$1")"