[Samba] script to check samba

Moeller Daniel (QI/EES3) * Daniel.Moeller at de.bosch.com
Mon Apr 29 04:06:02 GMT 2002


On Apr. 1st, MarshallJ at switch.aust.com wrote:

	Another question is: Is there a way to test for a logon using
smbclient or 
	similar tool? I'd like to be able to get a job in cron to test
whether 
	it's working and alert me before the windows users start to
complain.

Some time ago I wrote such a tiny script to check our Samba servers:

#!/bin/sh
#
# script to check Samba availiability
# Daniel Moeller (dannym at gmx.de), 29. Apr. 2002
#
# change these parameters
HOST=<yourServer>
USER=<user>
PASSWD=<passwd>
WDOMAIN=<Windows-domain>
MAILADR=<admin at your.site.com>
#
/usr/local/samba/bin/smbclient -L \\$HOST -U $USER%$PASSWD -W $WDOMAIN >
/dev/null
rc=$?
if [ $rc != 0 ]; then
/usr/bin/mailx -s "Samba on $HOST has problems" $MAILADR << EOF
Attention!
 
Samba-Server on $HOST is not operating properly. User $WDOMAIN\$USER got an
error!
 
Mail has been generated by script /usr/local/samba/bin/smbtest on $HOST
EOF
fi
# end

If you wish to reply, please eMail me directly, as I'm currently not
subscribed to the mailing list.

Mit freundlichen Grüßen / Kind regards / Saludos cordiales

Daniel Möller
Robert Bosch GmbH
SC Operation, QI/EES3





More information about the samba mailing list