Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: perl parallel script

by frozenwithjoy (Priest)
on Mar 28, 2015 at 04:16 UTC ( #1121610=note: print w/replies, xml ) Need Help??


in reply to perl parallel script

After you run the script, run the following:

echo $?

Based on the change_password() subroutine, I expect you will get the value 1 back indicating there is an error and something doesn't match.

sub change_password { my ($host, $ssh) = @_; my ($pty) = $ssh->open2pty('passwd'); my $expect = Expect->init($pty); $expect->raw_pty(1); # $expect->log_user(1); if (answer_passwd($expect, 'current.*:', $old) and answer_passwd($expect, 'Enter new.*:', $new) and answer_passwd($expect, 'Retype new.*:', $new) and $expect->expect($timeout, "success")) { exit(0); } exit(1); }

Also, I'm wondering if this script will ever work as is, since it seems like it will always exit before it completes its 'mission'. Perhaps you could change that subroutine to by deleting the exit() statements or changing exit(0); to return;.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1121610]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (6)
As of 2020-09-29 11:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    If at first I donít succeed, I Ö










    Results (146 votes). Check out past polls.

    Notices?