Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

how to fire a telnet command other than expect

Posted on 2014-03-20
6
Medium Priority
?
810 Views
Last Modified: 2014-04-02
my telnet commands are:

1.  telnet localhost 6667  : this prompts a osgi promt

2.  osgi> bundle <number>

I need the output of the second command.
NOTE: It seems I dont have /usr/bin/expect on the server. It is a production server and i cannot install expect.
0
Comment
Question by:pvinodp
6 Comments
 
LVL 13

Accepted Solution

by:
Daniel Helgenberger earned 668 total points
ID: 39942931
NOTE: It seems I dont have /usr/bin/expect on the server. It is a production server and i cannot install expect.

The only way I know to script prompts is expect. You need it from the telnet client's side; so any client, not necessarily your server, will do.

However, if you do not need to login, this is worth a try:
telnet localhost 6667 << EOF
bundle <number>
EOF

Open in new window

0
 
LVL 86

Assisted Solution

by:CEHJ
CEHJ earned 668 total points
ID: 39943085
Why don't you use a Java Telnet api?
0
 
LVL 13

Expert Comment

by:Daniel Helgenberger
ID: 39943178
Actually a very good idea; did not think about anything else but bash.

Though I would use something more common in Linux:, witch should work out of the box: Perl or Python. This way you can even overcome logins; but you nay still need libraries like net-telnet.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 38

Assisted Solution

by:Gerwin Jansen, EE MVE
Gerwin Jansen, EE MVE earned 664 total points
ID: 39943642
You could also run use expect on your test or development server and connect to the production server using "telnet <production server> 6667". Do you have expect experience?
0
 

Author Comment

by:pvinodp
ID: 39944516
i cannot reach my production servers. And i do not know expect, but i can learn if needed.

Yes, my server can run java program and perl.

I found few articles on java and telnet. But as said already, that would need library. Which offcourse is not part of jdk. i found one with org.apache.commons.net.telnet.

Is it possible to write this in perl?
0
 

Author Closing Comment

by:pvinodp
ID: 39972012
I think expect is the way.. i am going with it.
I need to have expect installed no matter what library I use
0

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Suggested Courses
Course of the Month20 days, 21 hours left to enroll

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question