#!/usr/bin/perl use FindBin qw($Bin); my $jar = "$Bin/jmxterm.bin"; if( !(-f $jar)) { die("jmxterm not found!"); } # # use IO::Prompter; use Expect::Simple; die("ERROR!\n\n$0 \n\n") if (@ARGV <2); my $host = shift; my $port = shift; # my $lhost = '178.162.209.171'; # my $lport = '28763'; my $cmd = "$jar -- --nox11 -q --noprogress"; my $obj = new Expect::Simple { Cmd => $cmd, Prompt => [ -re => '\$>' , -re => '[\s]?>[\s ]?' , "Stage terminated.\n", "Disconnecting."], DisconnectCmd => 'exit', Verbose => 1, Debug => 0, Timeout => 10, RawPty => 1 }; while (prompt( -in => *STDIN )) { next if (!($_)); my $res = $_; warn $@ if $@; $obj->send( $res ); my $text = $obj->before; print "[X]\t $res\n$text\n"; } close JMX;