Visit Our UNIX and Linux User Community


Telnet errors coming on screen while using snarf command.


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Telnet errors coming on screen while using snarf command.
# 1  
Old 08-20-2013
Telnet errors coming on screen while using snarf command.

Hi Team,

I am using one script, It is working fine, the problem is it gives unwanted telnet errors when I am using it.
I just want to remove these unwanted errors/info from my screen.


bash-3.00$ cat raza_site_temp
#!/usr/bin/bash
#rj835b
IFS="|"
REGEX="$*"
echo
snarf2 -c "show chassis status" `showHosts gsx |egrep "$REGEX"` > /dev/null > d1d1
echo
cat d1d1 |egrep -i "Node|Temp"|sed '/Node/{x;p;x;}'
echo
echo
echo "GSX Temperature > 30C"
echo "*********************"
echo
cat d1d1|egrep "Node|Temp"|awk '{if ($1~/Node:/) print $1,$2; else if ($1~/Temperature/) print $0}'|sed '$!N;s/\n/ /'|awk '{if (substr($4,1,2)>30) print $2,"----->", $4}'|awk '{printf "%-10s %s %s\n", $1,$2,$3}'
echo
bash-3.00$


Output of the script


bash-3.00$ ./raza_site_temp hst

Enter GSX Login: Enter GSX Password:
telnet: Unable to connect to remote host: Connection refused
Connection to 10.24.63.67 closed by foreign host.
Connection to 10.24.63.68 closed by foreign host.
telnet: Unable to connect to remote host: Connection refused
Connection to 10.24.63.70 closed by foreign host.
telnet: Unable to connect to remote host: Connection refused
Connection to 10.24.63.72 closed by foreign host.
telnet: Unable to connect to remote host: Connection refused
Connection to 10.24.63.74 closed by foreign host.
telnet: Unable to connect to remote host: Connection refused
Connection to 10.24.63.98 closed by foreign host.
telnet: Unable to connect to remote host: Connection refused


Node: hstg1so Date: 2013/08/20 09:35:31 GMT
Temperature: 25C

Node: hstg2so Date: 2013/08/20 09:35:39 GMT
Temperature: 26C

Node: hstg3so Date: 2013/08/20 09:35:48 GMT
Temperature: 24C

Node: hstg4so Date: 2013/08/20 09:35:55 GMT
Temperature: 25C

Node: hstg5so Date: 2013/08/20 09:36:03 GMT
Temperature: 25C

Node: hstg6so Date: 2013/08/20 09:36:11 GMT
Temperature: 25C


GSX Temperature > 30C
*********************


bash-3.00$


When I fire script it will ask for password, then it will fetch data from different node, error coming from redundant ports.
I jus want these telnet and connection refused error does not appear on my screen.

Thanks
Raza
# 2  
Old 08-20-2013

You need to redirect STDERR to /dev/null as well to avoid these messages (unless inability to contact a host is of interest ;) ), we can do this by redirecting stderr to stdout [icode]2>&1[/icode] this is a very common idiom.
[code]snarf2 -c "show chassis status" `showHosts gsx |egrep "$REGEX"` > /dev/null > d1d1 2>&1[/code]


Duplicate thread... answered on the better formatted one.

Last edited by Skrynesaver; 08-20-2013 at 07:07 AM..

Previous Thread | Next Thread
Test Your Knowledge in Computers #184
Difficulty: Easy
Less than 4% of those surveyed at UNIX.com indicated that csh was their most useful shell.
True or False?

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Top Command Output is not coming via Cronjob

Dear All, I created a small script to get the CPU, GIS usage etc automatically. However when i run this script manually its working , but when i run through cronjob i am not getting any output. Can anyone please help me on this. I am using SuseLinux. Thank you in advance. #!/bin/sh {... (2 Replies)
Discussion started by: Nitin Kapoor
2 Replies

2. Shell Programming and Scripting

Want to remove telnet error/info from screen

Hi Team, I am using one script, It is working fine, the problem is it gives unwanted telnet errors when I am using it. I just want to remove these unwanted errors/info from my screen. bash-3.00$ cat raza_site_temp #!/usr/bin/bash #rj835b IFS="|" REGEX="$*" echo snarf2 -c "show... (2 Replies)
Discussion started by: Raza Ali
2 Replies

3. UNIX and Linux Applications

vnc viewer presents black screen along with GNOME settings daemon errors.

Hello folks, I'm remotely connecting through VNC to two machines, each running Red Hat 5.9, from mine which is running Windows 7. Both connections were working well before. However, now one of the machines only gives me a black screen, with a pop up that says: "There was an error starting... (1 Reply)
Discussion started by: Miguel E. Perez
1 Replies

4. AIX

xp to aix - telnet blank screen

hello, i am trying to test connection to a 5.3 box. from an xp machine, telnet connects but shows only a blank screen. cursor moves as i type, but no response back. have used telnet, putty and accuterm - all same result verified that telnet services are active in xp xp windoze firewall is... (10 Replies)
Discussion started by: allenhibbert
10 Replies

5. Red Hat

command line tool to disable screen lock and/or screen saver

Hi, I have a simple question : how to disable screen lock and/or sreen saver with command line with RHEL5.4 ? (1 Reply)
Discussion started by: albator1932
1 Replies

6. UNIX for Dummies Questions & Answers

Automatic logging (capture screen output) of telnet/ssh sessions on a Solaris node

Hi I am working in Solaris 10 and I want to monitor logs for every telnet/ssh session that tries to connect to the server. I need these logs to be generated in a file that I can fetch using ftp. I am a new user and a stepwise detail will be great BR saGGee (3 Replies)
Discussion started by: saggee
3 Replies

7. Linux

Possible errors in telnet

Am writing one script in which it will check whether a device listens on the specific port. using telnet, I have written the script. Now my doubt is I have to handle different kind of errors that telnet is giving. Anybody can give the list of errors and what is the cause of that error? So that I... (2 Replies)
Discussion started by: skmdu
2 Replies

8. Shell Programming and Scripting

Files are not coming in attachement by any command

Hi All I want to send a file thru a mail with an attachment. i tried using uuencode , but it says "bash: uuencode: command not found" and the same i am getting for mutt as well: "bash: mutt: command not found" Tried searching in all the forums but could not find anything... (2 Replies)
Discussion started by: Prateek007
2 Replies

9. HP-UX

telnet remsh rogin errors

hi everybody. can u help please . i have error: getpid: peer died: Error 0 on /var/adm/syslog/syslog.log. what does it means?how can i fix problem? also strange wen i make an rlogin from my affected host to annother one. it demands the password!!!! (0 Replies)
Discussion started by: hmaiida
0 Replies

10. UNIX for Dummies Questions & Answers

Errors installing Screen 4.0.2

I tried to install and use Screen4.0.2 for SunOS 5.8. WHen I go to execute screen it tries to start it, but shows a quick error: ttyn: Permission denied. and then... Sorry, could not find a PTY. Does anyone know what I might have done wrong? How can I get screen to work? Thanks in... (1 Reply)
Discussion started by: FredSmith
1 Replies

Featured Tech Videos