FiberChannel Rescan

#!/bin/bash

SLEEP_INTERVAL=300

echo "Scanning all fibre channel host adapters"

for i in `ls /sys/class/fc_host`
do
echo "Rescanning /sys/class/fc_host/${i}:"

echo " Issuing a loop initialization on ${i}:"
echo "1" > /sys/class/fc_host/${i}/issue_lip

echo " Scanning ${i} for new devices:"
echo "- - -" > "/sys/class/scsi_host/${i}/scan"

echo "Sleeping for ${SLEEP_INTERVAL} seconds"
sleep ${SLEEP_INTERVAL}
done