Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 3

#!

/bin/bash
#Collecting Server configuration detail for decommission process
choice=11
# Print to stdout

echo "1. Display the server OS details"

echo "2. Display the server IP details"

echo "3. Display the DNS configuration"

echo "4. Display the server version and MAC address"

echo "5. Display the server serial number"

echo "6. Display the server network details "

echo "7. Display the LUN information "

echo "8. Display the WWN number "

echo "9. Display the local storage details "

echo "10. Display the multipath I/O details"

echo -n "Please choose a word [1,2,3,4,5,6,7,8,9 or 10]? "

# Loop while the variable choice is equal 11

# bash while loop

while [ $choice -eq 11 ]; do

# read user input

read choice

# bash nested if/else

if [ $choice -eq 1 ] ; then

uname -a

else

if [ $choice -eq 2 ] ; then

ifconfig -a | sed -n '2p' | awk ' { print $2 }'

else

if [ $choice -eq 3 ] ; then

cat /etc/resolve.conf

else

if [ $choice -eq 4 ] ; then


cat /etc/redhat-release
ifconfig -a | sed -n '1p' | awk ' { print $4, $5 } '

else

if [ $choice -eq 5 ] ; then

dmidecode | grep -i serial

else

if [ $choice -eq 6 ] ; then

netstat -a

else

if [ $choice -eq 7 ] ; then

cat /proc/scsi/scsi
dmesg | grep -i "attached "

else

if [ $choice -eq 8 ] ; then

systool -c scsi_host -v
cat /sys/class/scsi_host/host*/port_name

else

if [ $choice -eq 9 ] ; then

fdisk -l

else

if [ $choice -eq 10 ] ; then

multipath -ll

else

echo "1. Display the server OS details"

echo "2. Display the server IP details"

echo "3. Display the DNS configuration"

echo "4. Display the server version and MAC address"

echo "5. Display the server serial number"

echo "6. Display the server network details "

echo "7. Display the LUN information "

echo "8. Display the WWN number "


echo "9. Display the local storage details "

echo "10. Display the multipath I/O details"

echo -n "Please choose a word [1,2,3,4,5,6,7,8,9 or 10]? "

choice=11

fi

fi

fi

fi

fi

fi

fi

fi

fi

fi

done

You might also like