Problems using smbclient in cron job

Thuy-Linh Chu tlchu at rigel.com
Thu Aug 1 01:34:07 GMT 2002


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