I would like to use SSH to login to a remote system, then using FTP,
upload a file from the remote machine to another machine which will
display the data. If I can automate this process, I think I'll be in
great shape, tell me does this code seem like it would work for this?
>use Net::SSH::Perl; 
>my $ssh = Net::SSH::Perl->new($host);  #Logging into the remote machine

>$ssh->login; 
>my($READ, $WRITE) = $ssh->open2($cmd); 
>print $WRITE "cd /var/log\n";
>print $WRITE "ftp\n";
>print $WRITE "open $mainhost\n";               #FTP connecting to main
web host to display the files.
>print $WRITE "username\n";
>print $WRITE "password\n"; 
>print $WRITE "cd /central/storage/location\n";
>print $WRITE "put filenamea\n";
>print $WRITE "put filenameb\n";
>print $WRITE "put filenamec\n";
>print $WRITE "bye\n";                  #Disconnecting from the main web
host
>close($ssh);                                   #Disconnecting from the
SSH host


Peace,
Mark-Nathaniel Weisman
President / Owner
Weisman Bros. Construction
Anchorage, Alaska


Reply via email to