The following script runs perfectly when run from the # prompt logged in as 
root on our sles9 sp4 instance.
However, when run in the startup process as S16starttapes  forinstance, the 
second drive does not add, and the message that it does add is also printed.
Also, the output numbers from the fgreps do not show up in the log file.
How do I solve this one?

--------------- script begins here -------------------

#!/bin/bash
#
#
# finishes definitions for ts1120 drives until we get the discovery problem 
resolved.
# author gary lee
# date created 02/13/2009
#
# begin logging with current date/time
#
date >>/root/tapeadd.log
#
# check to see what tape drives are visible to the system
e1b="`fgrep -c 3590 /proc/scsi/IBMtape` ";export e1b
echo $e1b 3590 drives detected >>/root/tapeadd.log
ts1120="`fgrep -c 3592 /proc/scsi/IBMtape` ";export ts1120
echo $ts1120 3592 drives detected >>/root/tapeadd.log
#
# now finish definition for first 1120 if necessary
#
if [ $ts1120 -eq 0 ]; then
  echo 0x0000000000000000 
>/sys/bus/ccw/drivers/zfcp/0.0.0402/0x500507630f594801/unit_add
rv="`fgrep -c 3592 /proc/scsi/IBMtape` ";export rv
fi
#
# check for errors in drive addition
#
if [ $rv -eq 0 ]; then
  echo ERROR: drive on device 0402 failed >>/root/tapeadd.log
  exit1
fi
#
echo drive on device 0402 added successfully >>/root/tapeadd.log
sleep 2
# first addition successsful, now add next drive
#
  echo 0x0000000000000000 
>/sys/bus/ccw/drivers/zfcp/0.0.0403/0x5005076302411b6a/unit_add
  rv2="`fgrep -c 3592 /proc/scsi/IBMtape` ";export rv2
#
# check if drive added successfully
#
if [ $rv2 -lt 2 ]; then
  echo ERROR:  drive on device 0403 failed >>/root/tapeadd.log
  exit1
fi
#
echo drive on device 0403 added successfully >>/root/tapeadd.log
# drives added successfully now exit
exit 0

-------------- script ends ----------------

Thanks for any help.


__________ Information from ESET NOD32 Antivirus, version of virus signature 
database 3852 (20090213) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com

----------------------------------------------------------------------
For LINUX-390 subscribe / signoff / archive access instructions,
send email to lists...@vm.marist.edu with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390

Reply via email to