perl - Writing the output of an SSH command to a file -


using net::openssh module, how can connect host , subsequently capture/write output of command file has been created?

this command:

ps -ef | grep jboss | grep java 

i have following perl script far..

open path,">","./report/archive/rpet-$now/path.txt" or die "unable create file: $!";     $ssh = net::openssh->new(                 $host,                 user=>$username                 passwd=>$password     );     print path "ssh output go here"; close path; 

so best way run command , print output? in advance!

did @ documentation (https://metacpan.org/module/net::openssh)? it's in synopsis.

print path $ssh->capture('command'); 

though print error conditions too. capture works in both scalar , list context.


Comments

Popular posts from this blog

c# - SVN Error : "svnadmin: E205000: Too many arguments" -

c# - Copy ObservableCollection to another ObservableCollection -

All overlapping substrings matching a java regex -