Break tools out into modules

This commit is contained in:
2023-03-09 11:15:53 +01:00
parent 522854ab3d
commit 04273c2422
5 changed files with 149 additions and 114 deletions

View File

@@ -0,0 +1,33 @@
qnode() {
[ $# -lt 1 ] && echo "Usage qnode JOBID" && return 0
squeue --noheader --jobs $1 -o %R
}
qssh() {
[ $# -lt 1 ] && echo "Usage qssh JOBID" && return 0
ssh $(qnode $1)
}
taillog() { [ $# -lt 1 ] && echo "Usage taillog LOGFILE [JOBIDs ..]" && return 0
if [ $# -lt 2 ] ; then
tail "$1"
else
tail "$1" "$1.$2"{.e,.o}
fi
}
catlog() { [ $# -lt 1 ] && echo "Usage catlog LOGFILE [JOBIDs ..]" && return 0
if [ $# -lt 2 ] ; then
cat "$1" | less
else
cat "$1" "$1.$2"{.e,.o} | less
fi
}
watchlog() { [ $# -lt 2 ] && echo "Usage watchlog INTERVAL LOGFILE [JOBIDs ..]" && return 0;
if [ $# -lt 3 ] ; then
watch -n $1 tail "$2"
else
watch -n $1 tail "$2" "$2.$3"{.e,.o}
fi
}