[TriLUG] Perl question

Greg Brown gwbrown1 at gmail.com
Fri Mar 13 19:56:42 EDT 2009


If port 22 is closed it will stall the script.  I can get the script to exit
but not jump to the next iteration.

The obvious thing is to check for for 22 being open, but I also want to use
the same 'next' at a couple of other key places if possible.


On Fri, Mar 13, 2009 at 7:52 PM, Allen Freeman <knieveltech at yahoo.com>wrote:

> What happens if you just go
>
> $ssh = Expect->spawn("ssh -l $username $ip")
>
> If this call failing shouldn't stall your script why check to see if it's
> successful in the first place?
>
> Sorry I can't be of more immediate help, I quit coding perl two years ago.
>
>
> --- On Sat, 3/14/09, Greg Brown <gwbrown1 at gmail.com> wrote:
> From: Greg Brown <gwbrown1 at gmail.com>
> Subject: [TriLUG] Perl question
> To: "Triangle Linux Users Group General Discussion" <trilug at trilug.org>
> Date: Saturday, March 14, 2009, 4:08 AM
>
> Can anyone help me out what this will work:
>
> $ssh = Expect->spawn("ssh -l $username $ip") || die
> "didn't work: $!\n";
>
> but this will NOT work:
>
> $ssh = Expect->spawn("ssh -l $username $ip") || next;
>
> nor will this
>
> next if (not $ssh = Expect->spawn("ssh -l $username $ip"));
>
> I'd really REALLY like to have the failures skip to the next one.. I've
> got
> over 1000 routers to update tonight via this script and it's killing me
> stopping ever 5 or so because TACACS isn't properly configured (or whatever
> the malady is).
>
> Any help would be greatly appreciated!!
>
> Greg
> --
> TriLUG mailing list        : http://www.trilug.org/mailman/listinfo/trilug
> TriLUG FAQ  : http://www.trilug.org/wiki/Frequently_Asked_Questions
>
>
>
>
> --
> TriLUG mailing list        : http://www.trilug.org/mailman/listinfo/trilug
> TriLUG FAQ  : http://www.trilug.org/wiki/Frequently_Asked_Questions
>



More information about the TriLUG mailing list