Re: rsync and Perl programming
escape your @. I don't remember the details, but I know it got chewed up by something in a past application. Tim Conway Unix System Administration Contractor - IBM Global Services desk:3032734776 [EMAIL PROTECTED] 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 [EMAIL PROTECTED]::samba/rsynctestfiles /usr/share/smbshare/rsynctestfiles; $pid = open(PH, $rsync_cmd 21 |); # with an openpipe while (PH) {# plus a read print $_; } print finished\n; # -- To unsubscribe or change options: http://lists.samba.org/mailman/listinfo/rsync Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html
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 [EMAIL PROTECTED]::samba/rsynctestfiles /usr/share/smbshare/rsynctestfiles; $pid = open(PH, $rsync_cmd 21 |); # 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 -- To unsubscribe or change options: http://lists.samba.org/mailman/listinfo/rsync Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html
Re: rsync and Perl programming
I just checked, and if it helps anybody any, the exact same thing happens if I use backticks instead of opening a filehandle to fire off rsync from within the Perl script. I know I COULD write a Bourne wrapper and run THAT from Perl - I've been using Bourne scripts from day one to automate my rsync tasks - but that's a pretty ugly hack. I'm hoping somebody's got a simpler answer for what's getting b0rk3d... Jim Salter JRS Systems -- To unsubscribe or change options: http://lists.samba.org/mailman/listinfo/rsync Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html
Re: rsync and Perl programming
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: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jim Salter Sent: Wednesday, May 05, 2004 2:31 PM To: [EMAIL PROTECTED] 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 [EMAIL PROTECTED]::samba/rsynctestfiles /usr/share/smbshare/rsynctestfiles; $pid = open(PH, $rsync_cmd 21 |); # 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 -- To unsubscribe or change options: http://lists.samba.org/mailman/listinfo/rsync Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html
Re: rsync and Perl programming
You didn't escape your @localhost, for one. Try $rsync_cmd = 'blah blah blah'; instead. -- Tom Allen Email: [EMAIL PROTECTED] Senior Open Systems EngineerPhone: 904-220-3627 10East Corp FAX: 904-384-1038 On Wed, 5 May 2004, Jim Salter wrote: 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 [EMAIL PROTECTED]::samba/rsynctestfiles /usr/share/smbshare/rsynctestfiles; $pid = open(PH, $rsync_cmd 21 |); # 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 -- To unsubscribe or change options: http://lists.samba.org/mailman/listinfo/rsync Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html -- To unsubscribe or change options: http://lists.samba.org/mailman/listinfo/rsync Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html
Re: rsync and Perl programming
On Wed, 5 May 2004, Jim Salter wrote: 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. Try unbuffering your I/O in the script. Add the following line somewhere towards the top: $| = 1; Note: that's the pipe symbol after the dollar sign. -Chuck -- http://www.quantumlinux.com Quantum Linux Laboratories, LLC. ACCELERATING Business with Open Technology The measure of the restoration lies in the extent to which we apply social values more noble than mere monetary profit. - FDR -- To unsubscribe or change options: http://lists.samba.org/mailman/listinfo/rsync Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html