cmd+=" >/dev/null 2>&1 || true"
fi
- if [[ "${SIMULATE}" == "y" ]] ; then
+ if [[ "${SIMULATE}" ]] ; then
info "Executing: ${cmd}"
return
fi
# Note the quotes around `$TEMP': they are essential!
eval set -- "${tmp}"
eval_common_options "$@"
- if [[ "${DEBUG}" == 'y' ]] ; then
+ if [[ "${DEBUG}" ]] ; then
declare -p REMAINING_OPTS
declare -p REMAINING_ARGS
fi
exit 2
fi
- if [[ "${SIMULATE}" != 'y' ]] ; then
+ if [[ -z "${SIMULATE}" ]] ; then
LOGFILE="${BACKUP_HOSTDIR}/backup.log"
fi
}
cmd+=" --verbose"
fi
cmd+=" > \"${dumpfile}\""
- if [[ "${SIMULATE}" == "y" ]] ; then
+ if [[ "${SIMULATE}" ]] ; then
info "Executing: ${cmd}"
return
fi
cmd+=" --verbose"
fi
cmd+=" > \"${dumpfile}\""
- if [[ "${SIMULATE}" == "y" ]] ; then
+ if [[ "${SIMULATE}" ]] ; then
info "Executing: ${cmd}"
else
debug "Executing: ${cmd}"
cmd+=" --verbose"
fi
cmd+=" > \"${dumpfile}\""
- if [[ "${SIMULATE}" == "y" ]] ; then
+ if [[ "${SIMULATE}" ]] ; then
info "Executing: ${cmd}"
continue
fi
cmd+=" --verbose"
fi
cmd+=" > \"${dumpfile}\""
- if [[ "${SIMULATE}" == "y" ]] ; then
+ if [[ "${SIMULATE}" ]] ; then
info "Executing: ${cmd}"
else
debug "Executing: ${cmd}"
cmd+=" --verbose"
fi
cmd+=" > \"${dumpfile}\""
- if [[ "${SIMULATE}" == "y" ]] ; then
+ if [[ "${SIMULATE}" ]] ; then
info "Executing: ${cmd}"
else
debug "Executing: ${cmd}"
cs_file="backup-checksums.${cs_type}"
info "Creating '${CYAN}${cs_file}${NORMAL}' ..."
cmd="${cs_type}sum *.gz > \"${cs_file}\""
- if [[ "${SIMULATE}" == "y" ]] ; then
+ if [[ "${SIMULATE}" ]] ; then
info "Executing: ${cmd}"
continue
fi
else
cmd+=" 2>&1 | tee -a \"${LOGFILE}\""
fi
- if [[ "${SIMULATE}" == "y" ]] ; then
+ if [[ "${SIMULATE}" ]] ; then
info "Executing: ${cmd}"
continue
fi
# Note the quotes around `$TEMP': they are essential!
eval set -- "${tmp}"
eval_common_options "$@"
- if [[ "${DEBUG}" == 'y' ]] ; then
+ if [[ "${DEBUG}" ]] ; then
declare -p REMAINING_OPTS
declare -p REMAINING_ARGS
fi
# Note the quotes around `$TEMP': they are essential!
eval set -- "${tmp}"
eval_common_options "$@"
- if [[ "${DEBUG}" == 'y' ]] ; then
+ if [[ "${DEBUG}" ]] ; then
declare -p REMAINING_OPTS
declare -p REMAINING_ARGS
fi
# Note the quotes around `$TEMP': they are essential!
eval set -- "${tmp}"
eval_common_options "$@"
- if [[ "${DEBUG}" == 'y' ]] ; then
+ if [[ "${DEBUG}" ]] ; then
declare -p REMAINING_OPTS
declare -p REMAINING_ARGS
fi
fi
local cmd="curl -o \"${TARGET_JAR}\" -s \"${DOWNLOAD_URL}\""
- if [[ "${SIMULATE}" == "y" ]] ; then
+ if [[ "${SIMULATE}" ]] ; then
info "Executing: ${cmd}"
else
debug "Executing: ${cmd}"
info "Checking SHA1 sum integrety of '${CYAN}${TARGET_JAR}${NORMAL}' ..."
if [[ ! -f "${TARGET_JAR}" ]] ; then
- if [[ "${SIMULATE}" == "y" ]] ; then
+ if [[ "${SIMULATE}" ]] ; then
debug "Simulation mode - jar file must not exists."
return 0
fi
empty_line
for service in "${services[@]}" ; do
info "Restarting '${CYAN}${service}${NORMAL}' ..."
- if [[ "${SIMULATE}" != "y" ]] ; then
+ if [[ -z "${SIMULATE}" ]] ; then
systemctl restart "${service}"
fi
MAIL_BODY+="$( my_date ): Restarted service '${service}'.\n"
done
- if [[ "${SIMULATE}" != "y" ]] ; then
+ if [[ -z "${SIMULATE}" ]] ; then
debug "Sleeping for 15 seconds ..."
sleep 15
fi
MAIL_BODY+="With best regards\n\n"
MAIL_BODY+="Your ${BASE_NAME}"
- if [[ "${SIMULATE}" == "y" ]] ; then
+ if [[ "${SIMULATE}" ]] ; then
local msg="Following mail should be sent:\n"
msg+="From: <${MAIL_FROM_ADDRESS}>\n"
msg+="To: <${MAIL_TO_ADDRESS}>\n"
# Note the quotes around `$TEMP': they are essential!
eval set -- "${tmp}"
eval_common_options "$@"
- if [[ "${DEBUG}" == 'y' ]] ; then
+ if [[ "${DEBUG}" ]] ; then
declare -p REMAINING_OPTS
declare -p REMAINING_ARGS
fi
# Standard global variables
VERBOSE=""
-DEBUG="n"
-DO_ASK="n"
-SIMULATE="n"
+DEBUG=""
+DO_ASK=""
+SIMULATE=""
QUIET="n"
LOGFILE=
exit 1
fi
- if [[ "${DEBUG}" = "y" ]] ; then
+ if [[ "${DEBUG}" ]] ; then
set -x
fi
done
fi
- if [[ "${SIMULATE}" == "y" ]] ; then
+ if [[ "${SIMULATE}" ]] ; then
echo
echo -e "${CYAN}Simulation mode!${NORMAL}"
echo "Nothing is really done."
if [[ "${VERBOSE}" ]] ; then
cmd="rm --verbose $*"
fi
- if [[ "${SIMULATE}" == "y" ]] ; then
+ if [[ "${SIMULATE}" ]] ; then
info "Executing: ${cmd}"
return
fi
if [[ "${VERBOSE}" ]] ; then
cmd="mkdir --verbose $*"
fi
- if [[ "${SIMULATE}" == "y" ]] ; then
+ if [[ "${SIMULATE}" ]] ; then
info "Executing: ${cmd}"
return
fi
if [[ "${VERBOSE}" ]] ; then
cmd="cp --verbose $*"
fi
- if [[ "${SIMULATE}" == "y" ]] ; then
+ if [[ "${SIMULATE}" ]] ; then
info "Executing: ${cmd}"
return
fi
if [[ "${VERBOSE}" ]] ; then
cmd="mv --verbose $*"
fi
- if [[ "${SIMULATE}" == "y" ]] ; then
+ if [[ "${SIMULATE}" ]] ; then
info "Executing: ${cmd}"
return
fi
if [[ "${VERBOSE}" ]] ; then
cmd="chown --verbose $*"
fi
- if [[ "${SIMULATE}" == "y" ]] ; then
+ if [[ "${SIMULATE}" ]] ; then
info "Executing: ${cmd}"
return
fi
if [[ "${VERBOSE}" ]] ; then
cmd="chmod --verbose $*"
fi
- if [[ "${SIMULATE}" == "y" ]] ; then
+ if [[ "${SIMULATE}" ]] ; then
info "Executing: ${cmd}"
return
fi
if [[ "${VERBOSE}" ]] ; then
cmd="ln --verbose $*"
fi
- if [[ "${SIMULATE}" == "y" ]] ; then
+ if [[ "${SIMULATE}" ]] ; then
info "Executing: ${cmd}"
return
fi