- 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}
+ 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
+ echo "Drive ${drive} Full (Storage element ${ld} loaded)"
+ exit 1