TCLUG Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SMB/scripting question



        I need to check for the existence of a file on an SMB share (and if
it exists at at time that it shouldn't, mail me an error message). I could
do an smbmount, do an ls for the file, get the return code, and (I think)
based on that, determine what to do. (then unmount the share)
        however, I found that smbclient can execute commands
non-interactively; and I was wondering if that might be more efficient than
smbmounting/umounting. this command will do an ls for the existence of the file:
smbclient //process/c <password> -c 'ls /bin/running.txt'

but how do I get a useful conditonal statement to act upon the results of that?
is it worthwhile to do that? or should I just write a script to mount the
share, check for the file, then unmount the share?

Carl Soderstrom