Reorder tests and add infos about force mode

This commit is contained in:
Jeremy Gardais 2020-07-06 17:05:06 +02:00
parent d5186390b3
commit 7229c8640e
Signed by: jegardai
GPG Key ID: E759BAA22501AF32
1 changed files with 20 additions and 19 deletions

View File

@ -47,8 +47,9 @@ OPTIONS:
Enable debug messages. Enable debug messages.
-f,--force -f,--force
Force to (re)enable a queue even if it was Try to (re)enable a queue even if it was previously
previously manually disabled (by a user). manually disabled (by a user) and avoid all checks
(pending upgrades, running processes, files,…).
--help --help
Print this help message. Print this help message.
@ -97,10 +98,10 @@ define_vars() { # {{{
${sge_hostname} is the current host." ${sge_hostname} is the current host."
## Enable to verify if pending upgrades are present ## Enable to verify if pending upgrades are present
CHECK_UPGRADE="0" CHECK_UPGRADE="0"
## Enable to verify if upgrades are running
CHECK_PROCESS="0"
## Enable to watch if some files are present ## Enable to watch if some files are present
CHECK_FILE="0" CHECK_FILE="0"
## Enable to verify if upgrades are running
CHECK_PROCESS="0"
else ## In case of a remote host else ## In case of a remote host
debug_message "define_vars \ debug_message "define_vars \
${sge_hostname} is not the current host." ${sge_hostname} is not the current host."
@ -112,10 +113,10 @@ ${sge_hostname} is not the current host."
if [ -n "${FORCE_MODE}" ] && [ "${FORCE_MODE}" -eq "0" ]; then if [ -n "${FORCE_MODE}" ] && [ "${FORCE_MODE}" -eq "0" ]; then
## Disable upgrade checking (remote host, asked behaviour,…) ## Disable upgrade checking (remote host, asked behaviour,…)
CHECK_UPGRADE="1" CHECK_UPGRADE="1"
## Disable process checking (remote host, asked behaviour,…)
CHECK_PROCESS="1"
## Disable files monitoring ## Disable files monitoring
CHECK_FILE="1" CHECK_FILE="1"
## Disable process checking (remote host, asked behaviour,…)
CHECK_PROCESS="1"
else else
## Ensure to define a value ## Ensure to define a value
FORCE_MODE="1" FORCE_MODE="1"
@ -403,6 +404,19 @@ main() { # {{{
&& exit 0 && exit 0
fi fi
## If we need to watch files
if [ "${CHECK_FILE}" -eq "0" ]; then
## If nologin file exist (error on upgrade,…)
### Exit
is_file_present "${file_nologin_path}" \
&& exit 0
## If all SGE queue(s) were manually disabled (not any flag file)
### Exit
is_file_absent "${sge_queue_flag_pattern}" \
&& exit 0
fi
## If we need to watch for processes ## If we need to watch for processes
if [ "${CHECK_PROCESS}" -eq "0" ]; then if [ "${CHECK_PROCESS}" -eq "0" ]; then
## If anything related to APT is currently running ## If anything related to APT is currently running
@ -416,19 +430,6 @@ main() { # {{{
&& exit 0 && exit 0
fi fi
## If we need to watch files
if [ "${CHECK_FILE}" -eq "0" ]; then
## If nologin file exist
### Exit
is_file_present "${file_nologin_path}" \
&& exit 0
## If all SGE queue(s) were manually disabled (not any flag file)
### Exit
is_file_absent "${sge_queue_flag_pattern}" \
&& exit 0
fi
## Simple debug message with color to valid current variables ## Simple debug message with color to valid current variables
debug_message "main Try to manage \ debug_message "main Try to manage \
SGE queue(s): ${RED}${sge_queues_name_print:=/dev/null}${COLOR_DEBUG}\ SGE queue(s): ${RED}${sge_queues_name_print:=/dev/null}${COLOR_DEBUG}\