Files
mastering-unix-ss/chapter21/function_all_defined_pdisks
Fabio Scotto di Santolo 4cc88d2f6e initial commit
2020-07-28 19:28:25 +02:00

27 lines
764 B
Plaintext
Executable File

function all_defined_pdisks
{
# TURN ON/OFF ALL LIGHTS:
# Loop through each of the system.s pdisks by using the "lsdev"
# command with the "-Cc pdisk" switch while using "awk" to extract
# out the actual pdisk number. We will either
# turn the identifier lights on or off, specified by the
# $SWITCH variable:
#
# Turn lights on: -y
# Turn lights off: -n
#
# as the $SWITCH value to the "ssaidentify" command, as used below...
echo "\nTurning $STATE ALL of the system.s pdisks...Please Wait...\n"
for PDISK in $(lsdev -Cc pdisk -s ssar -H | awk .{print $1}. | grep pdisk)
do
echo "Turning $STATE ==> $PDISK"
ssaidentify -l $PDISK -${SWITCH} || echo "Turning $STATE $PDISK Failed"
done
echo "\n...TASK COMPLETE...\n"
}