The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Telnet in a script insania Shell Programming and Scripting 5 04-15-2007 02:32 PM
telnet through script arun.viswanath UNIX for Dummies Questions & Answers 1 03-26-2006 01:33 PM
ksh telnet script rwunwla Shell Programming and Scripting 5 12-16-2005 09:22 AM
telnet in a script vaccari UNIX for Dummies Questions & Answers 10 10-10-2001 12:37 PM
telnet in a script vaccari IP Networking 4 12-15-2000 03:42 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 05-10-2009
Ahmad Ezzat Ahmad Ezzat is offline
Registered User
  
 

Join Date: May 2009
Posts: 2
Using Telnet in a script

Hi All,

I was trying to use telnet in a script to access a certain processor on a certain port to view some processes. The problem is that when I use telnet the output is displayed for me.

The script is:
#!/bin/sh
cd /ahmed/ezzat/
rm ss7trace.log
touch ss7trace.log
chmod 755 ss7trace.log
telnet 172.16.0.9 8100
ps > result
quit

At the line of telnet I get an output:
Trying 172.16.0.9...
Connected to 172.16.0.9.
Escape character is '^]'.
U-Qtil>

but thats not what I want. I want the script to telnet to the processor then do ps and write the result in the result file then quits without giving me the output of telnet to type ps.

Can anyone help me regarding this, I will be so thankful.

Best Regards,
Ahmed.
  #2 (permalink)  
Old 05-10-2009
devtakh devtakh is offline
Registered User
  
 

Join Date: Oct 2007
Location: Bangalore
Posts: 514
Use rsh or ssh to execute a command on a remote server.
  #3 (permalink)  
Old 05-10-2009
Ahmad Ezzat Ahmad Ezzat is offline
Registered User
  
 

Join Date: May 2009
Posts: 2
hi,

rsh and ssh are not working, for my case I have to telnet on a processor on a certain port.

I have one feedback regarding my case, is that after I run the script I get:
Trying 172.16.0.9...
Connected to 172.16.0.9.
Escape character is '^]'.
U-Qtil>

and then the ps command is done on the local server not the one I am telneting to. I want to do ps on the remote server and print its output in the result file on the local server.

BR,
Ahmed.
  #4 (permalink)  
Old 05-11-2009
BubbaJoe's Avatar
BubbaJoe BubbaJoe is offline
Registered User
  
 

Join Date: Oct 2008
Location: St Louis
Posts: 153
You may want to try something like this

The script is:
#!/bin/sh
cd /ahmed/ezzat/
rm ss7trace.log
touch ss7trace.log
chmod 755 ss7trace.log
telnet 172.16.0.9 8100 << !! > result
ps
quit
!!
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 05:32 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0