diff --git a/cluster/sge.disable.host.queue.sh b/cluster/sge.disable.host.queue.sh index 045465d..7e10fa6 100755 --- a/cluster/sge.disable.host.queue.sh +++ b/cluster/sge.disable.host.queue.sh @@ -51,6 +51,25 @@ debug_message() { # {{{ ## Print message if DEBUG is enable (=0) [ "${DEBUG}" -eq "0" ] && printf '\e[1;35m%-6b\e[m\n' "DEBUG − ${PROGNAME} : ${local_debug_message}" +} +# }}} +define_vars() { # {{{ + + ## If sge_hostname wasn't defined + if [ -z "${sge_hostname}" ]; then + ## Use local host for sge_hostname + sge_hostname="$(hostname -f)" + fi + + ## Get all queues name + sge_queues_name="$(qhost -h "${sge_hostname:=/dev/null}" -q -xml \ + | grep "queue name" \ + | cut -d"'" -f2 )" + sge_queues_name_print="$(qhost -h "${sge_hostname:=/dev/null}" -q -xml \ + | grep "queue name" \ + | cut -d"'" -f2 \ + | tr -s '\n' ' ' )" + } # }}} is_queue_enable() { # {{{ @@ -162,13 +181,8 @@ Try to disable SGE queue: ${RED}${local_sge_queue_name:=/dev/null}@${local_sge_h # }}} main() { # {{{ - sge_queues_name="$(qhost -h "${sge_hostname:=/dev/null}" -q -xml \ - | grep "queue name" \ - | cut -d"'" -f2 )" - sge_queues_name_print="$(qhost -h "${sge_hostname:=/dev/null}" -q -xml \ - | grep "queue name" \ - | cut -d"'" -f2 \ - | tr -s '\n' ' ' )" + ## Define all vars according the selected options + define_vars ## Simple debug message with color to valid current variables debug_message "main − Try to manage \