Suppressing output of a spawned telnet process


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Suppressing output of a spawned telnet process
# 1  
Old 06-29-2010
Suppressing output of a spawned telnet process

Hi,

I'm trying to spawn a telnet process and trying to do some actions in the remote host using expect script. I would like to know how to suppress all the output in order the user using the script should not be able to see any actions done on the remote host. I tried using the "log_user 0" which only suppresses the output of the spawned process but the actions performed on the remote host is still being displayed.

Thanks,
Arun Venktesh.V
# 2  
Old 06-29-2010
Could you post a small script that reproduces this behavior?
# 3  
Old 06-29-2010
In the below sample code I wanted the action "date" not shown to the user.
Code:
#! /usr/local/bin/expect --

set timeout 120
log_user 0

spawn telnet <hostname>

expect "login: $"
send " username\r"
expect "Password: $"
send "password\r"

expect "<prompt> $"
send "date\r"

expect "<prompt> $"
send "exit\r"

interact

# 4  
Old 06-29-2010
The only output I get is:

Code:
exit
Connection closed by foreign host.

expect version 5.44.1.15
# 5  
Old 06-29-2010
Hi Radoulov,

Are you not getting the output of date command on the terminal ?
# 6  
Old 06-29-2010
No. I'm getting only:

Code:
exit
Connection closed by foreign host.

What OS are you using?
# 7  
Old 06-29-2010
I'm using AIX and this is the output I'm getting

Code:
date
exit
Tue Jun 29 06:45:40 EDT 2010
<Hostname>exit
Connection closed.


Last edited by arun_maffy; 06-29-2010 at 07:46 AM.. Reason: adding script output
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. HP-UX

Suppressing errors from command output

Hi, When I run the command "print_manifest | grep "Main Memory", I get the note : # /opt/ignite/bin/print_manifest | grep "Main Memory" NOTE: Could not read the /etc/resolv.conf file. Main Memory: 196498 MB # How do I suppress the part : NOTE: Could not read the... (4 Replies)
Discussion started by: anaigini45
4 Replies

2. Shell Programming and Scripting

Telnet and get process count

Hi guys, I'm writing a script on a Solaris 10 server (server A) that needs to telnet 2 servers (server B & server C) and get a certain process count from these 2 servers. Then on server A, I check if both counts are greater than 17, I do a sendmail to concerned people. For the telnet part,... (7 Replies)
Discussion started by: frum
7 Replies

3. Shell Programming and Scripting

Redirect the output of the telnet to a file

Hi, I am using cygwin. Below is my script that reads all ip ports for iplist.txt and telnets to it. ( file="iplist.txt" while read line do echo $line echo $(telnet $line) done <"$file" ) > output2.txt ~ while the output2.txt gets the first echo but does not show the second... (2 Replies)
Discussion started by: mohtashims
2 Replies

4. Shell Programming and Scripting

Storing received value from send, spawned telnet session

Hi Guys, I'm completely new to bash and trying to write a script to spawn a telnet session to retrieve the RSSI value of my device and log the average value of the RSSI over 20 samples. I know that my command does return the RSSI value successfully but my bash scripting is letting me down. I'm... (5 Replies)
Discussion started by: bwkm
5 Replies

5. Shell Programming and Scripting

Process behavior different when spawned from single terminal

So this one just plain confuses me. I have a bunch of somewhat CPU intensive processes that all communicate using a shared memory region. Some of these programs are threaded and some also change the scheduling to FIFO or round robin. The good news is that everything works as long as I spawn... (3 Replies)
Discussion started by: talkingfennel
3 Replies

6. UNIX for Dummies Questions & Answers

Finding apache process id that is spawned by a wget

Hi, I have a situation where I am writing a programme that runs a series of long running PHP scripts that can take anything from 20 minutes to 10 hours to execute. I have a solution half implemented where I use via php exec(wget <location to command>) and get the process id back. This... (1 Reply)
Discussion started by: mrploddy
1 Replies

7. Shell Programming and Scripting

Suppressing the automatic output of "script"

Is there a way to suppress the output that script command displays - "Script command started..." (4 Replies)
Discussion started by: ggayathri
4 Replies

8. UNIX for Dummies Questions & Answers

Suppressing output to the screen

I want to check whether the variable read from the console is number or character , so i used echo $option|grep and checked the reuslt returned by grep cmd using $? But since I use echo the value is getting printed in the screen , I want to supress the o/p. Can anyone suggest how this can be... (1 Reply)
Discussion started by: rolex.mp
1 Replies

9. Shell Programming and Scripting

Is there any cmd to kill a process including its childs ( or sub processes spawned by

Dear Unix Gurus, Here is my query. If i start a script,it inturn calls many other scripts ..and most of them continue to run in parallel. Suppose,if i want to stop my script for some reason,i need to kill -9 each of the processes running.It becomes clumsy if the sub processes r more. ... (15 Replies)
Discussion started by: gvsreddy_539
15 Replies

10. UNIX for Dummies Questions & Answers

exit from telnet kills orbix process

Hi, I'm using a bourne shell to kick off a 3rd Pty app. This app uses Orbix. When I exit from the telnet session which started the app or hit CTRL-C at the command line, the orbix process dies, yet all other process remain. I've tried starting the app as a background process, but it still... (1 Reply)
Discussion started by: edgarm
1 Replies
Login or Register to Ask a Question