|
|
|
@ -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
|
|
|
|
|