diff --git a/common.d/functions.sh b/common.d/functions.sh index afe0cc0..9f152f3 100644 --- a/common.d/functions.sh +++ b/common.d/functions.sh @@ -25,7 +25,7 @@ mkdir_if_not_exists () umount_if_mouted() { - [ ! -d "$1" ] && return 0 + [ ! -d "$1" ] && return 1 if grep -qs "$(realpath "$1")" /proc/mounts; then umount "$1" return $? @@ -36,8 +36,8 @@ umount_if_mouted() umount_force() { - [ ! -d "$1" ] && return 0 - while true; do + [ ! -d "$1" ] && return 1 + for run in {1..5}; do umount_if_mouted "$1" && break log "Failed to umount $1. Trying again after 3 seconds" ierror sleep 3