rsync and Perl programming

Jim Salter jim at jrssystems.net
Wed May 5 18:38:59 GMT 2004


BINGO.  Unintended interpolation of the "@localhost" as an array instead 
of as a literal string.  Thanks Brian!

Jim Salter
JRS Systems

 > Brian Cross wrote:
 >
> Jim,
> 
> No idea's off hand, but set the -w debug option at the top of the script
> and see if it gives you more information regarding the error.
> 
> #!/usr/bin/perl -w
> 
> Brian.....
> 
> -----Original Message-----
> From: rsync-bounces+bcross=incyte.com at lists.samba.org
> [mailto:rsync-bounces+bcross=incyte.com at lists.samba.org] On Behalf Of
> Jim Salter
> Sent: Wednesday, May 05, 2004 2:31 PM
> To: rsync at lists.samba.org
> Subject: rsync and Perl programming
> 
> Hi everybody -
> 
> I'm trying to write a Perl wrapper for some rsync tasks that need doing.
> 
>   Problem is, there's some sort of odd interaction going on between Perl
> 
> and the daemon mode communication for the rsync client, and I'm at my 
> wit's end in trying to figure it out.
> 
> Here's the Perl script:
> 
> #####################################################
> #####################################################
> #!/usr/bin/perl
> $rsync_cmd = "/usr/local/bin/rsync -a --progress 
> --password-file=/usr/local/etc/rsyncd.passwd 
> ph34r at localhost::samba/rsynctestfiles
> /usr/share/smbshare/rsynctestfiles";
> 
> $pid = open(PH, "$rsync_cmd 2>&1 |");     # with an openpipe
> while (<PH>) {                            # plus a read
>          print $_;
> }
> 
> print "finished\n";
> 
> 
> #####################################################
> #####################################################
> 
> 
> 
> When I run the script, here is the output I get:
> 
> 
> #####################################################
> #####################################################
> 
> building file list ...
> link_stat 
> "/usr/share/smbshare/Work/rsync-backup-v2/ph34r/rsynctestfiles" failed: 
> No such file or directory
> 0 files to consider
> 
> wrote 25 bytes  read 20 bytes  90.00 bytes/sec
> total size is 0  speedup is 0.00
> rsync error: some files could not be transferred (code 23) at
> main.c(632)
> finished
> 
> 
> #####################################################
> #####################################################
> 
> Now the odd thing is, I can run the rsync command in $rsync_cmd just 
> fine from the shell - it rsyncs the directories in question without 
> problem.  And if I set $rsync_cmd to something using a local path (no 
> daemon-mode communication) for both source and target, it will run as 
> expected in my Perl script too.
> 
> I'm only having the odd problem shown when using daemon mode in my Perl 
> wrapper.  The system being used is running FreeBSD 5.1, and I have the 
> problem when running either rsync 2.6.0 from FreeBSD's ports tree or 
> 2.6.2 downloaded straight from the rsync site and compiled.
> 
> Any ideas?  (Help me, help me obi-Wayne...)
> 
> Jim Salter
> JRS Systems



More information about the rsync mailing list