[Ssh-sftp-perl-users] How to stop "error conditions" from terminating a script.
Brought to you by:
dbrobins
From: Jim L. <Jim...@rc...> - 2005-05-31 12:08:56
|
Hi, All I have an application that uses a table of hostnames, accounts and passwords to copy data from a set of remote servers using either FTP or SFTP as the case may be. I'm trying to write a check script that will use this table and determine whether the hosts can be contacted and if the file is available. I'm running into problems with Net::SFTP because some conditions (e.g. Expired password) are treated as errors and the script terminates at that point. I'd like to be able to trap and note the error and continue on. My logic looks like this: $args{user} =3D $account; $args{password} =3D $password; if ($sftp =3D Net::SFTP->new($host,%args)) { If for any reason the Net::SFTP->new doesn't work the whole script craps out with messages of the form: Connection closed at /home/jlane/bin/check line 41 I've seen earlier posts on this list about wrapping an eval around code to deal with errors but that doesn't seem to work for me. HELP! =20 Jim Lane =20 Capacity Planner =20 Rogers Shared Operations =20 (905)-513-3164 =20 FAX (905)-513-5012 =20 Jim...@rc... =20 |