(re)enable SGE queue only if disable by a script

Test if /etc/.sge.${QUEUE_NAME}.disable exist
This commit is contained in:
Jeremy Gardais 2020-06-22 13:25:34 +02:00
parent 138aecfb47
commit 3d01cb8487
Signed by: jegardai
GPG Key ID: E759BAA22501AF32
1 changed files with 12 additions and 6 deletions

View File

@ -218,13 +218,19 @@ enable_sge_queue() { # {{{
local_sge_hostname="${1}"
local_sge_queue_name="${2}"
## Simple debug message to valid current variables
debug_message "enable_sge_queue \
Try to enable SGE queue: ${RED}${local_sge_queue_name:=/dev/null}@${local_sge_hostname:=/dev/null}${COLOR_DEBUG}."
local_sge_disable="/etc/.sge.${local_sge_queue_name}.disable"
## SGE command to enable the queue
qmod --enable "${local_sge_queue_name}@${local_sge_hostname}" \
&& return_enable_queue="${?}"
## If the queue was previously disabled by another script
if [ -f "${local_sge_disable}" ]; then
debug_message "enable_sge_queue \
Try to enable SGE queue: ${RED}${local_sge_queue_name:=/dev/null}@${local_sge_hostname:=/dev/null}${COLOR_DEBUG}."
## SGE command to enable the queue
qmod --enable "${local_sge_queue_name}@${local_sge_hostname}" \
&& return_enable_queue="${?}"
else
debug_message "SGE queue: ${RED}${local_sge_queue_name:=/dev/null}@${local_sge_hostname:=/dev/null}${RESET} was manually disabled, please re-enable it ${RED}manually${RESET}."
return_enable_queue="1"
fi
return "${return_enable_queue}"