Sponsored Content
Top Forums Shell Programming and Scripting Need shell script to Telnet multiple node , Ping some IP and print output Post 302943519 by Ganesh Mankar on Sunday 10th of May 2015 01:52:36 AM
Old 05-10-2015
Need shell script to Telnet multiple node , Ping some IP and print output

Hi Team,
Need shell script to Telnet multiple node , Ping some IP and print output like pass or fail.
Need this script to check reachability of multiple nodes at same time.
Help me.

I use this but not working...
Eg.
in this script i need to telnet 5601:200:370:111::91 and ping 5601:200:13f:1d0:3:2:103:02 ip


IP_TABLES.txt
Code:
5601:200:370:111::91 5601:200:13f:1d0:3:2:103:02
5601:200:370:111::91 5601:200:11d:c00:3:2:103:52
5601:200:370:111::91 5601:200:11e:100:3:2:103:e1
5601:200:370:111::91 5601:200:11d:500:3:2:103:145
5601:200:370:112::71 5601:200:11d:500:3:2:103:c8
5601:200:370:112::71 5601:200:12d:500:3:2:103:47




Ping.sh
Code:
#!/bin/bash
 
pingcnt='10'
iptable_file="IP_TABLES.txt"
PASSWD="********"
SUBNODE_DIR=/home/nodeuser
ERROR="Transfer"



cat /home/lotus/bin/cmd/$iptable_file | while read IP
                                do
                                                echo $IP > temp.txt
                                                MAINNODE_IP=`awk '{print $1}' temp.txt`
                                                SUBNODE_IP=`awk '{print $2}' temp.txt`
                                               
                                                ping6 -c 10 $SUBNODE_IP > ping_$SUBNODE_IP.log &
                                done
 
                                echo ""
                                echo "**** WAIT until ping test end ****"
                                echo ""
 
                                sleep 10
 
                                echo"" >> result_ping.log
                                date >> result_ping.log
                                sleep 5
                                echo "--------- SUBNODE IP ---------" >> result_ping.log
 
                                cat /home/lotus/bin/cmd/$iptable_file | while read IP
                                do
                                                echo $IP > temp.txt
                                                SUBNODE_IP=`awk '{print $2}' temp.txt`
                                                cat ping_$SUBNODE_IP.log | grep transmitted > temp_$SUBNODE_IP.log
                                                data=`awk -F ',' '{print $3}' temp_$SUBNODE_IP.log`
                                                if [ -s temp_$SUBNODE_IP.log ]
                                                then
                                                                echo "$SUBNODE_IP  : $data" >> result_ping.log
                                                else
                                                                echo "$SUBNODE_IP  : 100% packet loss" >> result_ping.log
                                                fi
                                done
                                rm -rf ping_*
                                rm -rf temp*
                                sleep 10
                                cat  /home/lotus/bin/cmd/result_ping.log
                               
                               
                ;;
esac




output

Code:
unknown host
unknown host
unknown host
unknown host
unknown host
 
**** WAIT until ping test end ****
 
unknown host
 
Sat May  9 20:14:04 IST 2015
--------- SUBNODE IP ---------
 
Sat May  9 20:16:39 IST 2015
--------- SUBNODE IP ---------
5601:200: 100% packet loss126
5601:200: 100% packet lossa
5601:200: 100% packet loss2
5601:200: 100% packet loss8a
5601:200: 100% packet lossa
5601:200: 100% packet loss6

---------- Post updated 05-10-15 at 12:52 AM ---------- Previous update was 05-09-15 at 08:26 AM ----------

Hi Team,
Please help me....

Last edited by Don Cragun; 05-09-2015 at 03:05 PM.. Reason: Change ICODE tags to CODE tags again.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell script to search through numbers and print the output

Suppose u have a file like 1 30 ABCSAAHSNJQJALBALMKAANKAMLAMALK 4562676268836826826868268468368282972982 2863923792102370179372012792701739729291 31 60... (8 Replies)
Discussion started by: cdfd123
8 Replies

2. Shell Programming and Scripting

how can i print the output of the shell script in bigger size

how can i print the output of the shell script in bigger size eg: echo " hello world" i want to print this in the output with bigger size in the middle of the screen. can someone please help me out in that (2 Replies)
Discussion started by: mail2sant
2 Replies

3. 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

4. UNIX for Advanced & Expert Users

Shell Script to compare xml files and print output to a file

All, PLease can you help me with a shell script which can compare two xml files and print the difference to a output file. I have attached one such file for you reference. <Group> <Member ID=":Year_Quad:41501" childCount="4" fullPath="PEPSICO Year-Quad-Wk : FOLDER.52 Weeks Ending Dec... (2 Replies)
Discussion started by: kanthrajgowda
2 Replies

5. Solaris

Ping trace telnet monitoring script

Hello, it is my first post :) I need to implement some monitoring tools in a script, ping telnet traceroute I found this one to ping, it works, #!/bin/sh for i in `cat /tmp/PingStatus.txt` do ping -c 5 -w 5 -n $i | grep -q "bytes from" && echo "$i is OK" || opcmsg object=PING a=OS... (5 Replies)
Discussion started by: marmellata
5 Replies

6. Shell Programming and Scripting

Awk script to run a sql and print the output to an output file

Hi All, I have around 900 Select Sql's which I would like to run in an awk script and print the output of those sql's in an txt file. Can you anyone pls let me know how do I do it and execute the awk script? Thanks. (4 Replies)
Discussion started by: adept
4 Replies

7. Shell Programming and Scripting

Need bash script to ping the servers and rename the output file each time the script is ran

HI, I have a file serverlist in that all host names are placed. i have written a small script #./testping #! /bin/bash for i in `cat serverlist` do ping $i >> output.txt done so now it creates a file output.txt till here fine.. now each time i run this script the output file... (4 Replies)
Discussion started by: madhudeva
4 Replies

8. Shell Programming and Scripting

How to print the output of a select query using shell script?

HI, I want to connect to database and fetch the count from a table. The sql query is as below : select count(*) from table_test where test_column='read'; How can I print the output of this statement using shell script. Thanks in advance. (4 Replies)
Discussion started by: confused_info
4 Replies

9. Shell Programming and Scripting

Need to Print output in table using shell script

#! /bin/ksh #] && . ./.profile 2>/dev/null if test -f '.profile'; then . ./.profile; fi; #. .profile LOG_DIR=/app/rpx/jobs/scripts/just/logs sendEmail() { pzCType="$1"; pzTitle="$2"; pzMsg="$3"; pzFrom="$4"; pzTo="$5"; pzFiles="$6"; pzReplyTo="$7" ( ... (4 Replies)
Discussion started by: ankit.mca.aaidu
4 Replies

10. Shell Programming and Scripting

Shell script to ping multiple servers

Hi I did the following script to ping multiple servers, but I keep on receiveing duplicate emails for one server that is down: #!/bin/bash date cat /var/tmp/servers.list | while read output do ping -c 1 "$output" > /dev/null if ; then echo "node $output is up" else ... (10 Replies)
Discussion started by: fretagi
10 Replies
All times are GMT -4. The time now is 07:40 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy