scripts/fiber_channel/delete-fc-luns

21 lines
452 B
Bash
Executable File

#!/bin/ksh
PGM_LS_LUNS=/usr/local/sbin/ls_fc_luns
set -A tuples $($PGM_LS_LUNS | awk '$3 ~ /[0-9]:[0-9]:[0-9]:[0-9]/ {print $3}')
for tuple in "${tuples[@]}"
do
set -A parts $( echo $tuple | awk -F ':' '{print($1,$2,$3,$4)}' )
h=${parts[0]}
b=${parts[1]}
t=${parts[2]}
l=${parts[3]}
#echo $host $bus $tgt $lun
set -x
fn=/sys/class/scsi_host/host$h/device/subsystem/devices/$h\:$b\:$t\:$l/delete
[[ -f $fn ]] && echo "1" > $fn
set +x
done