Vous êtes sur la page 1sur 4

[mared9@itseelm-lx4492 scripts]$ more Lbporttest.

sh
#!/bin/bash
#
# Script for port listening test
#vRecipients=""
# Read Config file port and host details file
if [ -f ./hostdeatils.cfg ]
then
# Read input file as line by line
for line in `cat hostdeatils.cfg`
[mared9@itseelm-lx4492 scripts]$
###########################################################
[mared9@itseelm-lx4492 scripts]$ more Loadbalancerport.sh
#!/bin/bash
IFS=$'\n'
vMsg="Port connectionis successful"
# vDate=""
Host_name='prod.b2b.ikea.com'
Port_Number=0000
# echo -n "Enter Host name"
# read Host_name
# echo -n "Enter HTTP/HTTPS Port number"
# read Port_Number
# for line in `cat portdeatils.cfg`
while read line ;
do
# Ignore Comments in Cfg file
echo $line
done
#echo "$Port_Number" >>Response.txt
# curl -I https://$Host_name:$Port_Number/invoke/IKEA.IkeaBasic1.keepAlive/sta
tusCheck >>tempo.txt
# curl -I -u InfraScheduler:b2bInfra95Scheduler https://prod.b2b.ikea.com:$Po
rt_Number/invoke/IKEA.IkeaBasic1.keepAlive/statusCheckc >>tempo.txt
# HTTPRes=`grep "HTTP" tempo.txt`
# echo "$HTTPRes" >>Response.txt
# rm tempo.txt
[mared9@itseelm-lx4492 scripts]$
################################################
porttest_Demo.sh
#!/bin/bash
# Sukant Choudhary

IFS=$'\n'
if [ -f ./portdetails.cfg ]
then
echo "Port Details Found!! Continue!"
else
echo "portdeatils.cfg file not found!!!"
exit 0
fi
# Make Sure to update Host_name, Password & portdetails.cfg accordingly befor
e running the script. Run the scritp ./porttest_Demo.sh>.output. please remove
the pre
vious file with same output file name .
# Host CTE=cf.b2b.ikeadt.com,CTEF2=cf2.b2b.ikeadt.com, CTM=cm.b2b.ikeadt.com,PPE
=pp.b2b.ikeadt.com,PROD=prod.b2b.ikea.com
Host_Name="cf.b2b.ikeadt.com"
# echo -n "Enter Host name: "
# read Host_Name
User_name="InfraScheduler"
Password="InfraScheduler"
# Password="b2bInfra95Scheduler" //PROD password , Password=" b2bppInfra95Schedu
ler //PPPE password .Rest environment has user name & password same."
# echo -n "Enter Password for InfraScheduler User : "
# read Password
# Read input file as line by line
for line in `cat portdetails.cfg`
do
# ignore comments from input file
# if [ "${line:0:1}" != "#" ] ; then
port=`echo $line | cut -f1 -d ' '`
echo "$port"
temp_port=`expr $((port/100))`
# echo "$port" >>tmp.txt
echo "===================================================="
if [ "$temp_port" -eq "31" ]
then
curl -I -k -u $User_name:$Password -m 5 https://$Host_Name:$por
t/invoke/IKEA.IkeaBasic1.keepAlive/statusCheck >> tmp.txt
else
curl -I -k -u $User_name:$Password -m 5 http://$Host_Name:$port/
invoke/IKEA.IkeaBasic1.keepAlive/statusCheck >> tmp.txt
#vDate=$(date '+%C%y-%m-%d %H:%M:%S UTC')
fi
echo "===================================================="
value=`grep "HTTP" tmp.txt | cut -d " " -f2`
echo "port $port :" $value
rm -rf tmp.txt
echo "===================================================="
done
[mared9@itseelm-lx4492 scripts]$
###################################################################
[mared9@itseelm-lx4492 scripts]$ more porttest_Final.sh

#!/bin/bash
# Sukant Choudhary
IFS=$'\n'
if [ -f ./portdetails.cfg ]
then
echo "Port Details Found!! Continue!"
else
echo "portdeatils.cfg file not found!!!"
exit 0
fi
# Make Sure to update Host_name, Password & portdetails.cfg accordingly befor
e running the script. Run the scritp ./porttest_Demo.sh>.output. please remove
the pre
vious file with same output file name .
# Host CTE=cf.b2b.ikeadt.com,CTEF2=cf.b2b.ikeadt.com, CTM=cm.b2b.ikeadt.com,PPE=
pp.b2b.ikeadt.com,PROD=prod.b2b.ikea.com
Host_Name="cf.b2b.ikeadt.com"
# echo -n "Enter Host name: "
# read Host_Name
User_name="InfraScheduler"
Password="InfraScheduler"
# Password="b2bInfra95Scheduler" //PROD password , Password=" b2bppInfra95Schedu
ler //PPPE password .Rest environment has user name & password same."
# echo -n "Enter Password for InfraScheduler User : "
# read Password
# Read input file as line by line
for line in `cat portdetails.cfg`
do
# ignore comments from input file
# if [ "${line:0:1}" != "#" ] ; then
port=`echo $line | cut -f1 -d ' '`
echo " Port Number '$port ' Connection Test Resport"
temp_port=`expr $((port/100))`
# echo "$port" >>tmp.txt
echo "===================================================="
if [ "$temp_port" -eq "31" ]
then
curl -I -k -u $User_name:$Password -m 5 https://$Host_Name:$por
t/invoke/IKEA.IkeaBasic1.keepAlive/statusCheck >> tmp.txt
else
curl -I -k -u $User_name:$Password -m 5 http://$Host_Name:$port/
invoke/IKEA.IkeaBasic1.keepAlive/statusCheck >> tmp.txt
#vDate=$(date '+%C%y-%m-%d %H:%M:%S UTC')
fi
echo "===================================================="
value=`grep "HTTP" tmp.txt | cut -d " " -f2`
if [ "$value" == "200" ];
then
echo "port $port :" $value "Successfully Connected to $port"
else
echo "port $port :" " Connection is Unsucessful"
fi
rm -rf tmp.txt
echo "===================================================="

done
[mared9@itseelm-lx4492 scripts]$
#####################################################
-rwxr-xr-x 1 root root 1092 May 6 07:14 porttest.sh
[mared9@itseelm-lx4492 scripts]$ more porttest.sh
#!/bin/bash
IFS=$'\n'
if [ -f ./portdeatils.cfg ]
then
echo "Continue"
else
echo "portdeatils.cfg file not found!!!"
exit 0
fi
# Host_Name="prod.b2b.ikea.com"
# echo -n "Enter Host name: "
# read Host_Name
# Read input file as line by line
for line in `cat portdeatils.cfg`
do
# ignore comments from input file
# if [ "${line:0:1}" != "#" ] ; then
port=`echo $line | cut -f1 -d ' '`
temp_port=`expr $((port/100))`
echo "===================================================="
if [ "$temp_port" -eq "31" ]
then
curl -I -k https://prod.b2b.ikea.com:$port/invoke/IKEA.IkeaBasi
c1.keepAlive/statusCheck >> tmp.txt
else
curl -I -k http:/prod.b2b.ikea.com:$port/invoke/IKEA.IkeaBasic
1.keepAlive/statusCheck >> tmp.txt
#vDate=$(date '+%C%y-%m-%d %H:%M:%S UTC')
fi
echo "===================================================="
value=`grep "200" tmp.txt | cut -d " " -f2`
echo "port $port :" $value
rm -rf tmp.txt
echo "===================================================="
done
[mared9@itseelm-lx4492 scripts]$

Vous aimerez peut-être aussi