siddhanta has asked for the wisdom of the Perl Monks concerning the following question:
Hi, This is my first Perl Script.
Am trying to scp file from 1 server to another. Script is working fine. But I need to put some error handling logic that I usually use to do with shell script. 1) Redirect output of command to a file 2) Status of the previous command
Can you please help me to achieve above logic. I tried looking in google but did not find/understand the solution.
#!/usr/bin/perl use strict; use Net::SCP::Expect; my $user = 'user1'; my $host = 'host1'; my $pass = 'pass1'; my $src_file = "/home/Script_Name.txt"; my $dst_path = "/home/"; my $s = Net::SCP::Expect->new; $s->login($user, $pass); $s->scp("$host:$src_path",$dst_path);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Net::SCP::Expect Error Handling
by salva (Canon) on Jan 29, 2016 at 08:21 UTC | |
by siddhanta (Initiate) on Jan 29, 2016 at 08:43 UTC | |
by salva (Canon) on Jan 29, 2016 at 08:51 UTC | |
by siddhanta (Initiate) on Jan 29, 2016 at 11:20 UTC | |
by salva (Canon) on Jan 29, 2016 at 12:38 UTC | |
by siddhanta (Initiate) on Jan 29, 2016 at 11:03 UTC | |
by salva (Canon) on Jan 29, 2016 at 11:11 UTC |