HP 3PAR RedHat and Oracle Linux Implementation Guide

Using QLogic Scripts to Set the SCSI Timeout
The following script changes the SCSI timeout value to 60 seconds for LUNs discovered by each
of the QLogic HBA ports. Use this script if you are running Remote Copy.
If you have implemented the timeout value change using the udev method, then do not use this
script.
When you run the script, the SCSI timeout value for each of the current LUNs discovered will be
changed immediately. However, when rebooting the server, the timeout value will revert to the
default value of 30 seconds.
The following example shows the content for Script ql_ch_scsi_timeout.sh:
qlogicname="/sys/class/scsi_host"
timeout=60
ls $qlogicname | grep "[0-9][0-9]*" | while read line
do
fname=${qlogicname}/$line
curr=`pwd`
cd $fname
find . -follow -name "timeout" | grep -v "generic" | while read line2
do
vendorcheck=`cat ${line2%timeout}vendor | grep -c "3PARdata"`
if [ $vendorcheck -gt 0 ] ; then
echo "modifying file: [$fname$line2]"
echo "$timeout" > $line2
fi
done
cd $curr
done
You can have this script run during the OS boot up sequence by adding the contents of the script
into the /etc/rc.local file. Make sure /etc/rc.local file has the permissions values set
to 777.
The following example shows the contents of /etc/rc.local:
# cat /etc./rc.local
!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.
touch /var/lock/subsys/local
qlogicname="/sys/class/scsi_host"
timeout=60
ls $qlogicname | grep "[0-9][0-9]*" | while read line
do
fname=${qlogicname}/$line
curr=`pwd`
cd $fname
find . -follow -name "timeout" | grep -v "generic" | while read line2
do
vendorcheck=`cat ${line2%timeout}vendor | grep -c "3PARdata"`
if [ $vendorcheck -gt 0 ] ; then
echo "modifying file: [$fname$line2]"
echo "$timeout" > $line2
fi
done
cd $curr
done
Setting the SCSI Timeout 47