Solved

how to fire a telnet command other than expect

Posted on 2014-03-20
6
713 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 167 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 167 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
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 37

Assisted Solution

by:Gerwin Jansen
Gerwin Jansen earned 166 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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

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…
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

746 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now