Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
executable file 114 lines (103 sloc) 2.29 KB
#!/bin/bash
#
# Submits grid engine jobs
set -e
GT_NAME="${0##*/}"
name="${GT_NAME}"
# Enable debug mode
if [[ -n "${DEBUG}" ]]; then
set -x
fi
usage() {
cat <<EOF
usage: ${name/-/ } [--version] [--help]
[--config <path>] [--dry-run] [--verbose]
<command> [<args>]
Commands:
[most common]
st show the status of jobs on the cluster
file submit a job from the commands listed in a text file
re reschedule (resubmit) failed jobs
rm remove jobs
alter modify jobs
[configuration]
check check if gtools are setup and ready to use
config create a user config file (optional, enables fine-tuning)
[advanced]
cmd submit a single command from the command line
mcc compile Matlab code
r run a command on the submit host
See \`${name/-/ } help <command>' for more information on a specific command.
EOF
}
show_help() {
case "$1" in
'')
usage
;;
gt*)
man "${MAN_DIR}/gt.1"
;;
*)
if [[ -e "${MAN_DIR}/gt-$1.1" ]]; then
man "${MAN_DIR}/gt-$1.1"
break
else
echo "${name}: no manual entry for '$1'." >&2
exit 1
fi
;;
esac
}
main() {
if [[ -z "$1" ]]; then
usage
exit 1
fi
abspath="$(readlink -f "$0")"
LOCAL_DIR="${abspath%/*}" # used in the setup script
. "${LOCAL_DIR}/gt-setup.sh" || exit 1
while [[ $# -gt 0 ]]; do
case "$1" in
--version)
echo "${name}: gtools version ${VERSION}"
break
;;
--help|help)
shift
show_help "$@"
break
;;
--conf*)
shift
CONFIG_FILE="$1"
;;
--dry*)
DRY_RUN=1
;;
--verbose)
VERBOSE=1
;;
*)
if [[ -f "${CONFIG_FILE}" ]]; then
verbose "config: ${CONFIG_FILE}"
. "${CONFIG_FILE}" "$@"
else
verbose "config file does not exist: ${CONFIG_FILE}"
fi
if [[ -e "${LOCAL_DIR}/gt-$1.sh" ]]; then
local cmd="$1"
shift
verbose "executing: ${LOCAL_DIR}/gt-${cmd}.sh"
. "${LOCAL_DIR}/gt-${cmd}.sh" "$@"
break
else
unknown_command "$1"
exit 1
fi
;;
esac
shift
done
}
main "$@"