From 7f5f41575e673de50a1a330eef654b1cd2aeb7ed Mon Sep 17 00:00:00 2001 From: timoxa0 Date: Sun, 3 Nov 2024 13:23:15 +0500 Subject: [PATCH] functions: Add umount attemps counter --- common.d/functions.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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