On 2010.04.13 02:46, Chris Coggins wrote:
> I need to copy a small config file from one server to another. I'm
> generating the file on one server with a pretty complex script. I need
> to put that file on another server for immediate user access via html.
> I've tried just writing the file straight to the new server over the
> network using absolute paths but it doesn't work. I'm thinking that I
> can accomplish this instead through a perl-generated html page, to have
> the script copy the file from its source server and put it locally for
> use within the web page.
> 
> What would the code look like to do this?

I would use SSH. Just make sure that you have set up password-less
authentication, and that the user you are logging in with has
permissions on the file.

#!/usr/bin/perl

use warnings;
use strict;

use Net::SCP qw( scp );

my $file = "/home/steve/blah.txt";
my $dest = "ste...@pearl.ibctech.ca:/web/site_dir";

my $scp = new Net::SCP;
$scp->scp($file, $destination);

Steve

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to