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_queue_name="${2}"
return_disable_queue="1"
## Simple debug message to valid current variables
debug_message "disable_sge_queue \
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
## and get returned value
## and create a file for local queue
qmod --disable "${local_sge_queue_name}@${local_sge_hostname}" > /dev/null \
&& return_disable_queue="${?}" \
&& {
## fix returned value
## create a file for local queue if run from the host
if qmod --disable "${local_sge_queue_name}@${local_sge_hostname}" > /dev/null; then
return_disable_queue="0"
[ "${LOCAL_HOST}" -eq "0" ] && printf '%s' "by ${PROGNAME} script" > "${sge_queue_deactivator}"
}
fi
return "${return_disable_queue}"
}
# }}}
main() { # {{{