[Samba] Using smbmount in a script - no return value

Michael Barnes mbarnes at hcjb.org
Sat Dec 17 20:17:49 GMT 2005


For some of us simple minded types, like me, perhaps you could have a 
permanent file in the share and test for it after mounting.  Create the 
file NonsenseShare/iamhere

#!/bin/bash
smbmount //NonsenseShare /bad/mnt/point
if test -f /bad/mnt/point/iamhere ; then
     printf "The mount worked!\n"
else printf "Rats, it didn't work!\n"
fi

If you can't get a return value from one command, use another command :-)

HTH,
Michael

Mathew D. Watson told me on 12/17/2005 11:53:
> I'm trying to periodically mount an XP share on my linux box, and I've 
> noticed that smbmount doesn't return a value so I can't test for success 
> in my shell script:
> 
> #!/bin/bash
> smbmount //NonsenseShare /bad/mnt/point || echo "error with smbmount"
> 
> In this case smbmount silently fails.
> 
> I searched the archives and found a couple of messages about smbmount 
> demonizing before leaving a return value. Is there a good way to test 
> for the success or failure of smbmount?
> 
> Mat
> 
> 


More information about the samba mailing list