Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix substitution #228

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ghettoVCB-VMDKexclude.sh
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ logger() {
LOG_TYPE=$1
MSG=$2

if [[ "${LOG_LEVEL}" == "debug" ]] && [[ "${LOG_TYPE}" == "debug" ]] || [[ "${LOG_TYPE}" == "info" ]] || [[ "${LOG_TYPE}" == "dryrun" ]]; then
if [[ "${LOG_LEVEL}" == "debug" ]] && [[ "${LOG_TYPE}" == "debug" ]] || [[ "${LOG_TYPE}" == "info" ]] || [[ "${LOG_TYPE}" == "error" ]] || [[ "${LOG_TYPE}" == "dryrun" ]]; then
TIME=$(date +%F" "%H:%M:%S)
if [[ "${LOG_TO_STDOUT}" -eq 1 ]] ; then
echo -e "${TIME} -- ${LOG_TYPE}: ${MSG}"
Expand Down
20 changes: 10 additions & 10 deletions ghettoVCB.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# User Definable Parameters
##################################################################

LAST_MODIFIED_DATE=2020_12_28
LAST_MODIFIED_DATE=2021_03_15
VERSION=1

# directory that all VM backups should go (e.g. /vmfs/volumes/SAN_LUN1/mybackupdir)
Expand Down Expand Up @@ -958,7 +958,7 @@ ghettoVCB() {
fi

if [[ "${IGNORE_VM}" -eq 0 ]] && [[ -n "${PROBLEM_VMS}" ]] ; then
if [[ "$(echo $PROBLEM_VMS | sed "s@$VM_NAME@@")" != "$PROBLEM_VMS" ]] ; then
if [[ " ${PROBLEM_VMS} " == *" ${VM_NAME} "* ]] ; then
logger "info" "Ignoring ${VM_NAME} as a problem VM\n"
IGNORE_VM=1
#A VM ignored due to a problem, should be treated as a failure
Expand Down Expand Up @@ -1260,7 +1260,7 @@ ghettoVCB() {
echo
rm "${VMDK_OUTPUT}"

if [[ "${VMDK_EXIT_CODE}" != 0 ]] ; then
if [[ "${VMDK_EXIT_CODE}" -ne 0 ]] ; then
logger "info" "ERROR: error in backing up of \"${SOURCE_VMDK}\" for ${VM_NAME}"
VM_VMDK_FAILED=1
fi
Expand Down Expand Up @@ -1436,31 +1436,31 @@ getFinalStatus() {
FINAL_STATUS="###### Final status: OK, only a dryrun. ######"
LOG_STATUS="OK"
EXIT=0
elif [[ $VM_OK == 1 ]] && [[ $VM_FAILED == 0 ]] && [[ $VMDK_FAILED == 0 ]]; then
elif [[ $VM_OK -eq 1 ]] && [[ $VM_FAILED -eq 0 ]] && [[ $VMDK_FAILED -eq 0 ]]; then
FINAL_STATUS="###### Final status: All VMs backed up OK! ######"
LOG_STATUS="OK"
EXIT=0
elif [[ $VM_OK == 1 ]] && [[ $VM_FAILED == 0 ]] && [[ $VMDK_FAILED == 1 ]]; then
elif [[ $VM_OK -eq 1 ]] && [[ $VM_FAILED -eq 0 ]] && [[ $VMDK_FAILED -eq 1 ]]; then
FINAL_STATUS="###### Final status: WARNING: All VMs backed up, but some disk(s) failed! ######"
LOG_STATUS="WARNING"
EXIT=3
elif [[ $VM_OK == 1 ]] && [[ $VM_FAILED == 1 ]] && [[ $VMDK_FAILED == 0 ]]; then
elif [[ $VM_OK -eq 1 ]] && [[ $VM_FAILED -eq 1 ]] && [[ $VMDK_FAILED -eq 0 ]]; then
FINAL_STATUS="###### Final status: ERROR: Only some of the VMs backed up! ######"
LOG_STATUS="ERROR"
EXIT=4
elif [[ $VM_OK == 1 ]] && [[ $VM_FAILED == 1 ]] && [[ $VMDK_FAILED == 1 ]]; then
elif [[ $VM_OK -eq 1 ]] && [[ $VM_FAILED -eq 1 ]] && [[ $VMDK_FAILED -eq 1 ]]; then
FINAL_STATUS="###### Final status: ERROR: Only some of the VMs backed up, and some disk(s) failed! ######"
LOG_STATUS="ERROR"
EXIT=5
elif [[ $VM_OK == 0 ]] && [[ $VM_FAILED == 1 ]]; then # $VMDK_FAILED doesn't matter in this case
elif [[ $VM_OK -eq 0 ]] && [[ $VM_FAILED -eq 1 ]]; then # $VMDK_FAILED doesn't matter in this case
FINAL_STATUS="###### Final status: ERROR: All VMs failed! ######"
LOG_STATUS="ERROR"
EXIT=6
elif [[ $VM_OK == 0 ]] && [[ $VM_FAILED == 0 ]] && [[ $VMDK_FAILED == 0 ]]; then
elif [[ $VM_OK -eq 0 ]] && [[ $VM_FAILED -eq 0 ]] && [[ $VMDK_FAILED -eq 0 ]]; then
FINAL_STATUS="###### Final status: ERROR: No VMs backed up! ######"
LOG_STATUS="ERROR"
EXIT=7
elif [[ $VM_OK == 0 ]] && [[ $VM_FAILED == 0 ]] && [[ $VMDK_FAILED == 1 ]]; then
elif [[ $VM_OK -eq 0 ]] && [[ $VM_FAILED -eq 0 ]] && [[ $VMDK_FAILED -eq 1 ]]; then
FINAL_STATUS="###### Final status: ERROR: All VMs experienced at least a partial failure! ######"
LOG_STATUS="ERROR"
EXIT=8
Expand Down