sidux.com
sidux Requests - request for a script that will restart samba
diddy1234 - Jul 15, 2008 - 03:14 PM
Post subject: request for a script that will restart samba
unfortunately I do not have enough scripting experience, but I was wondering if anyone can help me with a script that does the following :-
If the user has mapped locations to samba shares and the sharing server is rebooted then the mount will never unmount locally.
the only way around this is to restart the samba service.
could this be done automaticly ?
i.e a small script runs that checks the mounts and if there is no response then stop and restart samba and then remount each mount.
h2 - Jul 15, 2008 - 06:03 PM
Post subject: RE: request for a script that will restart samba
To restart samba: as root: /etc/init.d/samba start
Re the testing, I'm not sure how you test a service that is technically running but isn't actually working or connected, that might be a useful thing I agree, but to do it automatically and be useful, the script would need to fire automatically every 5 minutes or so.
op4latino - Jul 16, 2008 - 12:20 AM
Post subject: RE: request for a script that will restart samba
I didn't quite understand the problem, but a test for samba could be
Code:
smbclient -L localhost -N >/dev/null && echo "yes" || echo "no"
The script returns "yes" if samba server is working.
to restart samba would be
Code:
/etc/init.d/samba restart
diddy1234 - Jul 17, 2008 - 10:54 AM
Post subject: RE: request for a script that will restart samba
op4latino, what I was getting at was a script that looks at the active mounts to another pc and if there is no reply then to restart samba and then remount the various network mount points again.
i.e. build in some redundancy to samba