samba share setup on linux clients

jbk jbk-SkCWf5sxpj0sV2N9l4h3zg at public.gmane.org
Mon Jan 19 18:13:26 EST 2009


John Abreau wrote:
> On Sun, Jan 18, 2009 at 10:49 AM, jbk <jbk-SkCWf5sxpj0sV2N9l4h3zg at public.gmane.org> wrote:
> 
>> This is working except if the server is off or the network
>> is down, then the user login will hang waiting for the
>> shares to mount.
>> So I would think a user script in ~/bin would be the thing
>> to do. In this script I would want to test if the server is
>> available and then if even better if the share is available.
>>  Then mount the share if success else die gracefully
>> without hanging the system. Even better would be to raise a
>> gnome window with the message "Share <share> not available.
>> Is the server on?"
> 
> 
> You seem to have the right idea there.
> 
>     ping -w 1 -c 1 SERVER
> 
> ping the server winth only 1 packet, and terminate ping after 1 second
> regardless of whether it got a response yet. So ping won't hang for a
> long time if the server or network is down.
> 
>     smbclient -NL SERVER
> 
> List shares on the server, don't prompt for a password. If you get a list,
> then the server must be up.
> 
> 
Thanks John,
The ping options as you've shown I used but hadn't thought 
of the smbclient test. I will incorporate it in the 
conditional ping && smbclient line. The script outline is 
established and I even have it working. The next level gets 
a little more complicated as I need to unmount and delete 
the mount points at the end of the user's session so that if 
the server is not on there isn't an empty mount point 
collecting user data. Unfortunately, gnome does not provide 
a mechanism to add a logout script and .bash_logout is not 
read because the shell is not a login shell. So the first 
script has to test for the mount point if the server is not 
available and delete the lingering mount points. Anyway I'll 
post the script when I have it working for both conditions.

Jim KR





More information about the Discuss mailing list