CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Advanced:
rsync perl

 



xenovass
Novice

May 11, 2010, 3:52 AM

Post #1 of 2 (2921 views)
rsync perl Can't Post

hi ! i have a problem with my script . im trying to rsync the directory backup_dbase and also its contents through my Perl script. But , when i schedule it to run every minute with cron it returns error code 65280 and also the '$!' says bad file Descriptor. When i run rsync through command line everything is fine ,it works! what is going wrong with this ? Also sometimes returns the code 3072 .

#!/usr/bin/perl

$sys=system ("/usr/bin/rsync -avz --rsh=/usr/bin/ssh -i /root/.ssh/mirror_id_rsa /root/backup_dbase root\@cronus.ds.unipi.gr:/root/" ) ;
if($sys != 0)
{print MYFILE "rsync error $sys : $! \n";
print MYFILE "----------------------------------------------------------------------------------\n";}


(This post was edited by xenovass on May 11, 2010, 3:53 AM)


FishMonger
Veteran / Moderator

May 11, 2010, 4:57 AM

Post #2 of 2 (2915 views)
Re: [xenovass] rsync perl [In reply to] Can't Post

Start by adding these 2 pragmas, which should be in every Perl script you write, and fix the issues they point out.

Code
use strict; 
use warnings;


Then use the list form of the system call.

If you still have the same problem, then use the File::Rsync module instead of the system call.

http://search.cpan.org/~leakin/File-Rsync-0.43/Rsync.pm

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives