Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

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?

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

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (3)
As of 2023-03-24 19:15 GMT
Find Nodes?
    Voting Booth?
    Which type of climate do you prefer to live in?

    Results (61 votes). Check out past polls.