[Samba] smbclient return status from shellscript?

Frank Matthieß fm+samba at Microdata-POS.de
Tue Sep 17 13:55:01 GMT 2002


Dienstag den 17.09.2002 um 15:38 CEST  +0200, schrieb Palmer Magnus:
> Hi,
> 
> I hope this is the correct mailinglist for my question.
> 
> I've made a script that sends a file to a NT shared folder.
> As long as I make a successfull connect, I get return status 0...
> This is a problem, since now I can't make a correct errorhandling if
> something goes wrong.
> 
> +/opt/samba-2.0.5a/bin/smbclient //mapa-lap/mapaPublic -E -d0 -I
> XXX.YYY.ZZZ.WWW -n mapa-lap -N -U guest -c put a.txt ;put a.txr 
> Added interface ip=XXX.YYY.ZZZ.WWW bcast=XXX.YYY.MMM.NNN
> nmask=255.255.255.192
> putting file a.txt as \a.txt (0.0333717 kb/s) (average 0.0333717 kb/s)
> a.txr does not exist            <<<<HERE THE LOCAL FILE DOES NOT EXIST <<<<<
> + echo 0
> 0

Why don'Ät you check the files befor you copy them via smbclient?

On a linux box with bash:

if [ -r a.txr ]; then
	smbclient //mapa-lap/mapaPublic ... put a.txr 
else
	echo "Error...."
fi

This should be similar with other shell's.

-- 
Frank Matthieß                                          fm at Microdata-pos.de




More information about the samba mailing list