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