All pastes #279810 Raw Edit

Unnamed

public text v1 · immutable
·published 2006-12-15 10:13 UTC
rendered paste body
cd ${MFGDBDIR}
for db in `ls *.db`
do
    dbname=$(dirname ${db})/$(basename ${db} .db)
    ailogname=${logdir}/${dbname}.${timestamp}.log

    echo "Backing up AI files for ${MFGDBDIR}/${dbname}" >> ${ailogname}
    $DLC/bin/rfutil ${dbname} -C aimage list >> ${ailogname}
    carryon=yes
    i=`printf '%02i' 1`
    while [ $carryon = "yes" ]
    do
        if [ ! -f ${backupdir}/${dbname}.${timestamp}-$i.ai ]
  then
        echo ${backupdir}/${dbname}.${timestamp}-$i.ai
          $DLC/bin/rfutil ${dbname} -C aimage full >/dev/null 2>/dev/null
    errcode=$?
    case $errcode in
     0) aifile=`$DLC/bin/rfutil ${dbname} -C aimage full | tail -1`
        echo $aifile >> ${ailogname}
              echo "copying $aifile ${backupdir}/${dbname}.${timestamp}-$i.ai" \
               >>${ailogname}
              cp $aifile ${backupdir}/${dbname}.${timestamp}-$i.ai \
               >>${ailogname}
               cperrcode=$?
               if [ $cperrcode -gt 0 ]
         then
       echo "copying $aifile \
                         ${backupdir}/${dbname}.${timestamp}-$i.ai failed" 
             exit $cperrcode
         fi
              $DLC/bin/rfutil $dbname -C aimage empty $aifile>>${ailogname}
               aierrcode=$?
               if [ $aierrcode -gt 0 ]
         then
       echo "aimage empty"
             exit $aierrcode
         fi
        ;;
         2) carryon=no
        ;;
    esac
  fi
        i=`expr $i + 1`
        i=`printf '%02i' $i`
    done
done