bash exit code when mount command failed

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



[Index of Archives]     [Gluster Development]     [Linux Filesytems Development]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux