[PLUG] NFS monitored mount

श्रीधर नारायण श्रीधर नारायण
Mon Sep 24 02:57:05 PDT 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>; 
else 
	echo "<mountpoint> is already mounted"; 
fi

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

Shridhar



More information about the plug-mail mailing list