SCCS-vsn: local/ukc/dump/dumpall/dumpdev.sh 1.5
# shell script to dump a single device
# the script is called with a single
# parameter - which is the device to be dumped
# shell script to dump a single device
# the script is called with a single
# parameter - which is the device to be dumped
dev=$1
if [ "$1" = "" ]
then
dev=$1
if [ "$1" = "" ]
then
- echo 'Usage: doadump device-name'
+ echo 'Usage: dumpdev device-name'
#
# Now we need the dump information from the cycle file
#
#
# Now we need the dump information from the cycle file
#
-awkprog="/^$dev/ { if ($NEXTSTATE == \$2) print \$4,\$5 }"
+awkprog="/^$dev/ { if ($NEXTSTATE == \$2) print \$4,\$5,\$6 }"
decodethis=`awk "$awkprog" < $dumpcycle`
if [ "$decodethis" = "" ]
then
decodethis=`awk "$awkprog" < $dumpcycle`
if [ "$decodethis" = "" ]
then
#
# This is really nasty - but
# now finally set the dump level and the tape range
#
# This is really nasty - but
# now finally set the dump level and the tape range
-LEVEL=`expr "$decodethis" : '^\(.*\) '`
-TAPE=`expr "$decodethis" : '^.* \(.*\)$'`
-if [ "$chkflg" = yes ]
-then
- echo "DUMP of /dev/$dev at level ${LEVEL} to tapes $TAPE"
- exit 1
-fi
-$dump ou${labelchk}${LEVEL} $TAPE /dev/$dev
+echo $decodethis | (
+ read LEVEL TAPESTEM TAPECYCLE
+ if [ "$chkflg" = yes ]
+ then
+ echo "DUMP of /dev/$dev at level ${LEVEL} to tapes $TAPESTEM $TAPECYCLE"
+ exit 1
+ fi
+ if [ "$TAPECYCLE" = "" ]
+ then
+ $dump oul${labelchk}${LEVEL} $TAPESTEM /dev/$dev
+ retval=$?
+ else
+ $dump oulm${labelchk}${LEVEL} $TAPESTEM $TAPECYCLE /dev/$dev
+ retval=$?
+ fi
-# dump returns 1 on a successful dump
+# dump returns 0 on a successful dump
-if [ $? = 1 ]
-then
- echo $NEXTSTATE > $statefile
-fi
+ if [ $retval = 0 ]
+ then
+ echo $NEXTSTATE > $statefile
+ fi
+)