Problems using smbclient in cron job

John Chambers JLChambers at Kliklok.com
Fri Aug 2 11:28:00 GMT 2002


Here is a complete script I run from cron for daily retrieval of files using
smbclient:

#----------------
cd /data/laser
smbclient \\\\shopserv1\\floor$ password -U username -c "cd history;get
partlist;get nestlines;exit"
#----------------

> -----Original Message-----
> From: smb-clients-admin at lists.samba.org
> [mailto:smb-clients-admin at lists.samba.org]On Behalf Of Thuy-Linh Chu
> Sent: Wednesday, July 31, 2002 9:34 PM
> To: smb-clients at lists.samba.org
> Subject: Problems using smbclient in cron job
> 
> 
> Hello,
> 
> I have a perl script that creates directories and put files in these
> directories using smbclient.  This script works fine if I execute it
> manually.  However, if if it is started via as a cron job, 
> nothing seems
> to happen.  No directories was created and no files were 
> transferred.  I
> tried setting log option to see what happenned but I couldn't get the
> log file to generate.  I'm not sure why since I'm a novice Samba user.
> 
> Below is the simplified code excerpt:
> 
> 
>   $cmd = "smbclient server password -U username -d 1 -l samba_log";
>   open SMB, "| $cmd" || die "Failed to open Samba connection.\n";
> 
>   print SMB "cd basedir\n";
>   print SMB "mkdir subdir\n";
>   print SMB "cd subdir\n";
>   print SMB "put local_file remote_file\n;
> 
> The connection seems to be established because the program did not die
> when openning connection.  I tried sending Samba output to /dev/null,
> but still it does not work.
> 
> I would appreciate it if you could let me know how I could get this to
> work as a cron job.  Thanks.
> 
> -- 
> 
> Thuy-Linh Chu




More information about the smb-clients mailing list