Mark wrote...
> (with Perl almost all things are possible)
Okay, I take the challenge ;-) The example below talks from one
HPe3000 to another HPe3000, but telnet is telnet, so source could
also be Unix or Linux or Mac or ... and target could be Unix or
Linux as well.
Details at http://www.editcorp.com/personal/lars_appel -> Java Tips
Lars ---cut here--- Appel
:print ./BatchTelnet.java
class BatchTelnet {
public static void main(String[] args) throws Exception {
HostIO host = new HostIO();
host.open("my3000.grc.hp.com");
host.answerTo("MPE/iX:", "hello java,lars.appel/mypass");
host.skipUntilEquals(":");
host.pushBack();
host.answerTo(":", "showjob [log in to unmask]");
host.skipLines(1); // the cmd echo
while (! host.readln().equals(":")) {
System.out.println(host.getLine());
}
host.pushBack();
host.answerTo(":", "bye");
host.skipUntilStartsWith("CPU=");
host.close();
}
}
:stream
>!job lars,user.acct
>!java -version
>!java BatchTelnet
>!eoj
#J573
>:
:print !hplastspid.out.hpspool
JOB LARS,USER.ACCT,LAPPEL.
Priority = DS; Inpri = 8; Time = UNLIMITED seconds.
Job number = #j573.
SAT, AUG 12, 2000, 7:04 PM.
HP3000 Release: C.55.00 User Version: C.55.07
MPE/iX HP31900 C.05.08 Copyright Hewlett-Packard 1987.
. . .
:java -version
java version "JDK 1.1.7B"
:java BatchTelnet
JOBNUM STATE IPRI JIN JLIST INTRODUCED JOB NAME
#J186 EXEC 10S LP THU 9:11A JHTTPD,WWW.APACHE
#J188 EXEC 10S LP THU 9:11A JSERV,SECURE.APACHE
#J195 EXEC 10S LP FRI 11:26A JHTTPDS,MGR.APACHE
3 JOBS (DISPLAYED):
0 INTRO
0 WAIT; INCL 0 DEFERRED
3 EXEC; INCL 0 SESSIONS
0 SUSP
JOBFENCE= 0; JLIMIT= 60; SLIMIT= 60
:eoj
CPU sec. = 5. elapsed min. = 1. SAT, AUG 12, 2000, 7:05 PM.
|