Scripting smbclient

Anthony.M.Asleson at Anthony.M.Asleson at
Wed Jan 3 23:35:45 GMT 2001

I am in the process of using smbclient to automate a file transfer in perl
and I have the following question:

The smbclient(Version 2.0.7) appears to only return 0 and all output to
stdout, thus the only way to tell if the transfer occurred without errors
appears to be if I check stdout checking for all known errors.  This will
work, but it would be nice if:

a. The client returned 0 or 1 if the "-c" option was specified on the
command line
b. The messages could be in a more standard grouping (i.e. always were
prefixed by ERR etc)
c. Returns a "success" or "no errors or warnings" when used with "-c",
something to represent all is well :-)

My only concern is that I will miss an error condition because I didn't
explicitly check for every possible error condition that exists and also
that I may need to change when the client changes or miss some new error

For example it appears that I should check for some of the following in
stdout before I can declare success:

Unable to resolve name
characters in service

Am I missing something or is there a better way to do this?  I have looked
at some perl modules that use smbclient and they appear to check the output
with regular expressions etc.  I need to make this automated scripting as
reliable as possible.

Thank you!


More information about the samba mailing list