See A little demo for Net::SSH2.
As far as blocking and channels go, it's not simple, read perldoc Net::SSH2::Channel
If you want to exec something on the server, use this:
#!/usr/bin/perl use warnings; use strict; use Net::SSH2; my $pass = 'hahahaha'; my $ssh2 = Net::SSH2->new(); $ssh2->connect('localhost') or die "Unable to connect Host $@ \n"; #plain password login #$ssh2->auth_password('z','ztester') or die "Unable to login $@ \n"; # works when run from z's homedir because you need # permission to read the keys $ssh2->auth_publickey('zentara', '/home/zentara/.ssh/id_dsa.pub', '/home/zentara/.ssh/id_dsa', $pass ); my $chan = $ssh2->channel(); $chan->blocking(1); $chan->exec("nohup /home/zentara/perlplay/net/zzsleep > foo.out 2> foo +.err < /dev/null &"); $chan->send_eof; exit;
In reply to Re: Need Help on Net::SSH2 Module Usage on Windows
by zentara
in thread Need Help on Net::SSH2 Module Usage on Windows
by tarunmudgal4u
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |