From 3869f55dfac633e3d9580a2fb0e99a9c55a1e6f7 Mon Sep 17 00:00:00 2001 From: Mike Hiretsky Date: Thu, 21 Jan 2010 18:06:23 +0300 Subject: [PATCH] Increase wait time for mounting remote --- data/client | 35 +++++++++++++++-------------------- 1 file changed, 15 insertions(+), 20 deletions(-) diff --git a/data/client b/data/client index 495d5cd..8fc641d 100644 --- a/data/client +++ b/data/client @@ -13,31 +13,26 @@ start() { # Mount remote Samba filesystems. ebegin "Mounting domain resources" # Identifing domen server by env file - SERVER=`cat /var/calculate/calculate.env | grep cl_remote_host | awk '{print \$3}'` - let COUNT=20 - while let "${COUNT} > 0"; - do - if ping -w2 -c1 $SERVER &>/dev/null; - then - break; - else - sleep 1; - fi - let COUNT=COUNT-1 - done + local env_file=/var/calculate/calculate.env + if [[ -f $env_file ]] + then + local SERVER=$( sed -rn 's/^cl_remote_host\s*=\s*(\S+)$/\1/p' $env_file ) + for COUNT in $( seq 0 1 ) + do + ping -w2 -c1 $SERVER &>/dev/null && break || sleep 1 + done + fi cl-client --mount eend $? "Some samba remote resources to mount" } + stop(){ ebegin "Unmount domain resources" - if [[ `mount | grep ' /var/calculate/remote '` ]]; - then - umount /var/calculate/remote - fi - if [[ `mount | grep '/var/calculate/client-home on /home '` ]]; - then - umount /home - fi + [[ $( mount | grep ' /var/calculate/remote ' ) ]] && + umount /var/calculate/remote + [[ $( mount | grep '/var/calculate/client-home on /home ' ) ]] && + umount /home + eend 0 } # vim:ts=4