Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 29 Oct 2013 10:51:26 -0400
From:      Jerry <jerry@seibercom.net>
To:        FreeBSD <freebsd-questions@freebsd.org>
Subject:   Re: Check to see if share is mounted
Message-ID:  <20131029105126.0858ba0d@scorpio>
In-Reply-To: <20131029125508.a7525980.freebsd@edvax.de>
References:  <20131029074019.5a7a75b9@scorpio> <20131029125508.a7525980.freebsd@edvax.de>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 29 Oct 2013 12:55:08 +0100
Polytropon articulated:

> That's quite easy. Just query "df" and grep for the name of
> the mountpoint or the CIFS name ("device field" as it appears
> in /etc/fstab). Here's an example:
> 
> 	if [ df | grep "/home/bob/stuff" ]; then
> 		... do stuff when share is mounted ...
> 	else
> 		echo "CIFS share not availble."
> 		exit 1
> 	fi

That doesn't work under Bash. I modified it and now it works fine.

if ( df | grep 'Path_To_Mount' &>\dev\null ); then
	echo "It is mounted"
else                                                            
	echo "Not mounted"                                                                                                                              
fi 

-- 
Jerry ♔

Disclaimer: off-list followups get on-list replies or get ignored.
Please do not ignore the Reply-To header.
__________________________________________________________________




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20131029105126.0858ba0d>