Manage return of disable function

This commit is contained in:
Jeremy Gardais 2022-08-17 17:14:22 +02:00
parent 70e7c27c72
commit 0b0f678837
Signed by: jegardai
GPG Key ID: E759BAA22501AF32
1 changed files with 8 additions and 9 deletions

View File

@ -255,22 +255,21 @@ disable_sge_queue() { # {{{
local_sge_hostname="${1}" local_sge_hostname="${1}"
local_sge_queue_name="${2}" local_sge_queue_name="${2}"
return_disable_queue="1"
## Simple debug message to valid current variables ## Simple debug message to valid current variables
debug_message "disable_sge_queue \ debug_message "disable_sge_queue \
Try to disable SGE queue: ${RED}${local_sge_queue_name:=/dev/null}@${local_sge_hostname:=/dev/null}${COLOR_DEBUG}." Try to disable SGE queue: ${RED}${local_sge_queue_name:=/dev/null}@${local_sge_hostname:=/dev/null}${COLOR_DEBUG}."
## SGE command to disable the queue ## SGE command to disable the queue
## and get returned value ## fix returned value
## and create a file for local queue ## create a file for local queue if run from the host
qmod --disable "${local_sge_queue_name}@${local_sge_hostname}" > /dev/null \ if qmod --disable "${local_sge_queue_name}@${local_sge_hostname}" > /dev/null; then
&& return_disable_queue="${?}" \ return_disable_queue="0"
&& { [ "${LOCAL_HOST}" -eq "0" ] && printf '%s' "by ${PROGNAME} script" > "${sge_queue_deactivator}"
[ "${LOCAL_HOST}" -eq "0" ] && printf '%s' "by ${PROGNAME} script" > "${sge_queue_deactivator}" fi
}
return "${return_disable_queue}" return "${return_disable_queue}"
} }
# }}} # }}}
main() { # {{{ main() { # {{{