X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=bacula%2Fscripts%2Fdisk-changer.in;h=208bc95553ddf88e7fddd46830d0614b17cc9647;hb=be6ca5c8902b3888d71252ce7aaf92a0093ae393;hp=8a901558bc57c8b2a06dda35df87f66b8bc0ba44;hpb=a44f01482f8b65b0851f474076565a12c07eee79;p=bacula%2Fbacula diff --git a/bacula/scripts/disk-changer.in b/bacula/scripts/disk-changer.in index 8a901558bc..208bc95553 100644 --- a/bacula/scripts/disk-changer.in +++ b/bacula/scripts/disk-changer.in @@ -4,7 +4,7 @@ # # Written by Kern Sibbald # -# Copyright (C) 2000-2007 Free Software Foundation Europe e.V. +# Copyright (C) 2000-2008 Free Software Foundation Europe e.V. # # The main author of Bacula is Kern Sibbald, with contributions from # many others, a complete list can be found in the file AUTHORS. @@ -191,7 +191,12 @@ case $cmd in unload) debug "Doing disk -f $ctl unload $slot $device $drive" get_dir - ld=`cat $dir/loaded${drive}` + if [ -f $dir/loaded${drive} ]; then + ld=`cat $dir/loaded${drive}` + else + echo "Storage Element $slot is Already Full" + exit 1 + fi if [ $slot -eq $ld ]; then echo "0" >$dir/loaded${drive} unlink $device 2>/dev/null >/dev/null @@ -205,25 +210,37 @@ case $cmd in load) debug "Doing disk $ctl load $slot $device $drive" get_dir + i=0 + while [ $i -le $maxdrive ]; do + if [ -f $dir/loaded${i} ]; then + ld=`cat $dir/loaded${i}` + else + ld=0 + fi + if [ $ld -eq $slot ]; then + echo "Drive ${i} Full (Storage element ${ld} loaded)" + exit 1 + fi + i=`expr $i + 1` + done if [ -f $dir/loaded${drive} ]; then ld=`cat $dir/loaded${drive}` else ld=0 fi - if [ $ld -eq 0 ]; then - echo "0" >$dir/loaded${drive} - unlink $device 2>/dev/null >/dev/null - rm -f $device - ln -s $dir/slot${slot} $device - rtn=$? - if [ $rtn -eq 0 ]; then - echo $slot >$dir/loaded${drive} - fi - exit $rtn - else + if [ $ld -ne 0 ]; then echo "Drive ${drive} Full (Storage element ${ld} loaded)" exit 1 fi + echo "0" >$dir/loaded${drive} + unlink $device 2>/dev/null >/dev/null + rm -f $device + ln -s $dir/slot${slot} $device + rtn=$? + if [ $rtn -eq 0 ]; then + echo $slot >$dir/loaded${drive} + fi + exit $rtn ;; list)