broken pipe error


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers broken pipe error
# 8  
Old 03-13-2012
Quote:
Originally Posted by methyl
This will not work because typeahead is not allowed for the username and password in telnet.

The original script in post #1 does work when all parameters are correct, with the exception of logout which should be exit .
Surely Remote Shell would be easier to work with - and that too can be configured for automatic login.
Not sure if it's relevant but the computer I'm telnetting to is running VxWorks.

I was told to use telnet and ssh only. If I cannot use a here doc, is there another way to telnet without piping? I tried the code below which doesn't work.

Code:
echo username > $TMPFILE
echo password >> $TMPFILE
echo command >> $TMPFILE
echo logout >> $TMPFILE
 
telnet server < $TMPFILE


Last edited by aimeet; 03-13-2012 at 12:36 PM..
# 9  
Old 03-13-2012
What Operating System and version are you using and what Shell do you use?

Some posters would suggest using the unix "expect" command, but not every unix has that command. Personally I have had no reliable success with automating "telnet" because is is intended to be resilient to scripted "trial-and-error" login attacts. I just use Remote Shell if I want to run a command on another computer (it's the insecure version of "ssh").
# 10  
Old 03-13-2012
Quote:
Originally Posted by methyl
What Operating System and version are you using and what Shell do you use?

Some posters would suggest using the unix "expect" command, but not every unix has that command. Personally I have had no reliable success with automating "telnet" because is is intended to be resilient to scripted "trial-and-error" login attacts. I just use Remote Shell if I want to run a command on another computer (it's the insecure version of "ssh").
I'm on AIX 5.3 using Korn shell.

So one (dumb) fix I tried was to redirect standard output to a file then grep that file for what I need. If I can't figure out a better way to do it, this is what I'll check in. At least it works!
# 11  
Old 03-13-2012
Quote:
So one (dumb) fix I tried was to redirect standard output to a file then grep that file for what I need.
Not dumb, sensible approach. I'd also redirect STDERR to another file.
There is only so much you can do in a pipeline. Sometimes your script will need to read the log file more than once. Also you get an audit/diagnostic trail which is so much easier to debug.

Code:
mycommand 1>mystdout.log 2>mystderr.log

For some reason this works a lot better for comms commands (incl. telnet, remsh, nslookup, ping etc.) than:
Code:
mycommand 2>&1 >mycombinedlog.log

Where is CFAJohnson when you need him?
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How can we overcome Broken pipe error during scp,SFTP,Rsync while transferring big files.?

Hello All, Hope all are doing well. We use scp (some times sftp and rsync also) for transferring big files (around 2GB each ) from 1 Network to another Network. The Issues which we face :- During transfer some times( Once in 1 week (or twice)) , the speed of transfer gets down to 30 kb/s,... (2 Replies)
Discussion started by: Upendra Bhushan
2 Replies

2. Solaris

RWSocket::send: Broken pipe Error in /var/adm/messages

Hi Guys, I am getting some strange error in /var/adm/messages in my Solaris 10 box with Veritas Cluster and EMC storage. bash-3.00$ cat /var/adm/messages | egrep -v "lw8|snmp|sshd|xntpd|kern.info|LOGIN|link|service|started|finished|repeated|SS7 Log-daemon|success" Dec 18 09:58:35 GAMMa2... (1 Reply)
Discussion started by: vivek.goel.piet
1 Replies

3. UNIX for Dummies Questions & Answers

SFTP error between UNIX to iSeries (Write Failed Broken Pipe)

Hi, I am iseries resource and having Issue in one of the sFTP failures between one of my job (Unix --> iSeries). The response to sending machine (Unix) is "Write Failed Broken Pipe". Appreciate any help Available on why this Issue happens, how can we replicate the same, what fixes can... (1 Reply)
Discussion started by: hamelchauhan
1 Replies

4. Shell Programming and Scripting

Broken Pipe error

Hello while doing sftp over server "A" , i am getting a broken pipe error i.e cat: write error: Broken pipe what does that mean? please let me know if you want any other info on this.. (3 Replies)
Discussion started by: urfrnddpk
3 Replies

5. UNIX for Advanced & Expert Users

sftp error:- Couldn't send packet: Broken pipe

Hi, I am trying to sftp a large file(appx. 2 GB size) from solaris 10 to a Linux server. While sftping(with no options), connection is terminated after some time with broken pipe error. sftp with option -R1 or -B1500 is successful. Linux server ssh Version: OpenSSH_3.9p1, OpenSSL 0.9.7a... (3 Replies)
Discussion started by: brij123
3 Replies

6. Shell Programming and Scripting

Replace pipe with Broken Pipe

Hi All , Is there any way to replace the pipe ( | ) with the broken pipe (0xA6) in unix (1 Reply)
Discussion started by: saj
1 Replies

7. UNIX for Dummies Questions & Answers

echo: write error: Broken pipe ??

I want to try the unix pipe, the command is like this: echo new | find . the standard output of the echo should be "new", then I guess find command will use this output as input to find the file named "new". But the output is all the file names in my current dir, the last line is "echo: write... (5 Replies)
Discussion started by: andrewust
5 Replies

8. Programming

Broken Pipe error

All, I am using the below code The C code : if ((fp2=fopen(szout_fname,"r"))==NULL) { sprintf(stream_ptr1,"cat %s | sort -t, -rn -k 11,11 | awk -F\",\" '{ \ if ( \$3 ==\"%s\" ) {print... (0 Replies)
Discussion started by: arunkumar_mca
0 Replies

9. AIX

broken pipe error

Hi, I am working on AIX 5.3 . I have client-server program which is in ProC.while sending packet to server i am getting error as broken pipe and program exiting. please help?/? (1 Reply)
Discussion started by: ajaysahoo
1 Replies

10. Linux

pipe broken

hi i have a server, and i have a web site and i installed apache in the /usr/local/apache/logs i have a file and i have this problem (32)Broken pipe: core_output_filter: writing data to the network plz help me how i can resolve this plz it's urgent th (2 Replies)
Discussion started by: abir2
2 Replies
Login or Register to Ask a Question