Add simulation mode without any modifications

This commit is contained in:
Jeremy Gardais 2020-06-15 13:48:52 +02:00
parent d7dd9bd592
commit 03178436a9
Signed by: jegardai
GPG Key ID: E759BAA22501AF32
1 changed files with 16 additions and 7 deletions

View File

@ -17,10 +17,14 @@ readonly NBARGS="${#}"
## Export DEBUG for sub-script
export DEBUG
# If output message should be displayed
[ -z "${OUTPUT_MESSAGE}" ] && OUTPUT_MESSAGE=0
## Export OUTPUT_MESSAGE for sub-script
export OUTPUT_MESSAGE
# If modifications should be applied
[ -z "${SIMULATE_MODE}" ] && SIMULATE_MODE=1
## Colors
readonly PURPLE='\033[1;35m'
readonly RED='\033[0;31m'
@ -156,11 +160,16 @@ prepare_host_for_upgrade() { # {{{
disable_host_queue_script="${PROGDIR}/disable.host.queue.sh"
debug_message "prepare_host_for_upgrade \
Disable SGE queue."
sh "${disable_host_queue_script}"
if [ "${SIMULATE_MODE}" -eq 0 ]; then
return 0
else
return "${?}"
debug_message "prepare_host_for_upgrade \
Disable SGE queue."
sh "${disable_host_queue_script}"
return "${?}"
fi
}
# }}}
@ -218,9 +227,9 @@ if [ ! "${NBARGS}" -eq "0" ]; then
## Avoid to display any message on standard output
OUTPUT_MESSAGE=1
;;
-s|--silent ) ## Silent mode
## Avoid to display any message on standard output
OUTPUT_MESSAGE=1
-s|--simulate ) ## Simulate mode
## Only display messages
SIMULATE_MODE=0
;;
-- ) ## End of options list
## End the while loop