Some important "for loop" script to support in your day-today life (BAU)
To identify the disk size on the
server:
for s in `lspv|awk '{print $1'}`;do
echo $s `bootinfo -s $s`; done
To identify the lun number of the
disks in lpar
for s in `lspv|awk '{print $1'}; do
echo $s `odmget CuAt|grep -wp $s|grep -i value|head -1|awk '{print $3'}|cut
-c12-15`; done
To identify the lun number of the disks in vio server.
for s in `lspv|awk '{print $1'}; do
echo $s `odmget CuAt|grep -wp $s|grep -i value|head -1|awk '{print $3'}|cut
-c8-11`; done
To identify the wwpn of the fcs
card:
for s in `lscfg |grep fcs|awk
'{print $2'}`; do echo $s `lscfg -vl $s|grep -i netowrk|awk '{print $2'}|cut
-c21-37`; done
To identify the wwpn of the fcs in
vio server:
for s in `lsdev -type adapter|grep
fcs|awk '{print $1'}`; do echo $s `lsdev -dev $s -vpd|grep Network`; done
To idenfy the c-slot numer of the
disk (It is useful to identify the mapping with vio server)
for s in `lspv|awk '{print $1'}`; do echo $s
`lscfg -vl $s|grep -i $s|cut -c42-44`; done
To get the vhost information of the
particular disk on the vio server.
for s in `lsmap -all|grep -p
hdiskX|grep -i vtd|awk '{print $2'}`; do lsdev -dev $s -field parent|tail -1;
done
To identify the Ethernet card info
on the server (This is useful before you do reboot)
for s in `lsdev -Cc adapter|grep -i
ent|awk '{print $1'}`; do echo $s; lsattr -El $s; echo "========================";
done
for s in `ifconfig -a|grep -i :|awk
'{print $1'}|grep -i en|cut -c1-3`; do echo $s; lsattr -El $s; echo
"======================"; done
for s in `lsde v-Cc adapter|grep -i
ent|awk '{print $1'}`; do echo $s; entstat -d $s; echo
"==========================="; done
To get the server name against the
ip address
for s in `cat server_network`; do
echo $s `nslookup $s|grep -i name|awk '{print $4'}`; done
To get the IP address against the
server-name
for s in `cat server_network`; do
echo $s `nslookup $s|grep -i address`; done
To enable the failed paths on the
server.
for s in `lspath|grep -i failed|awk
'{print $2'}`; do chpath -l $s -p `lspath|grep -i failed|awk '{prit $3'} -s
Enabled; done