[Gluster-users] bash exit code when mount command failed

Darren Austin darren-lists at widgit.com
Mon Jul 11 12:09:39 UTC 2011


----- Original Message -----
> Hy, when a mount command fail (for some reason, server unavailable,
> volume not exists....) the system don't show any error message.
>
> # mount -t glusterfs serveroff:/notexistvolume /mnt (the server not
> exist and the volume not exist !)
> # echo $?
> 
> when I digit "echo $?" I'm expect that the command return NOT 0
> (zero). I want using mount command in an external script bash and test
> if the mount command are executed correctly.

I had noticed the same thing, and intended to post a note about it too :)

The way I worked around this issue is to use the "mountpoint" command directly after the mount.
Eg:

mount -t glusterfs server:volume /mnt
mountpoint /mnt
echo $?

... will do what you want :)

HTH,
Darren.

-- 
Darren Austin - Systems Administrator, Widgit Software.
Tel: +44 (0)1926 333680.    Web: http://www.widgit.com/
26 Queen Street, Cubbington, Warwickshire, CV32 7NA.




More information about the Gluster-users mailing list