[PLUG] NFS monitored mount

श्रीधर नारायण दैठणकर ghodechhap at ghodechhap.net
Mon Sep 24 15:27:05 IST 2007

On Monday 24 Sep 2007 15:09:51 Ketan Padegaonkar wrote:
> On 9/24/07, Aditya Godbole <aag.lists at gmail.com> wrote:
> > Hi,
> > I want to mount a NFS share if it has not been mounted already. The
> > program should  return success if the share is already mounted or if
> > it gets mounted successfully, and failure otherwise.
> > Is there any existing script/daemon I can use?
> Did you look at autofs and automount ?
> (http://tldp.org/HOWTO/Automount.html)

Also isn't this simple enough?

if [  `mount|grep <mountpoint> >|wc -l` -eq 0 ]; then 
	mount <mountpoint>; 
	echo "<mountpoint> is already mounted"; 

Actually just blindly mount works too. It gives a warning which you can ignore 
but at the end share is guaranteed to be mounted :)


More information about the Plug-mail mailing list