Subversion Repositories programming

Rev

Blame | Last modification | View Log | RSS feed

#!/bin/bash

################## CONFIG OPTIONS ##############################################
DLDIR="/home/irasnyd/downloads/usenet"              # "global" download dir  ###
GLOGDIR="/home/irasnyd/downloads/usenet/logs"       # "global" logdir        ###
################################################################################

### Clean up global logs ###
cleanup_logs() {
rm -f ${GLOGDIR}/badfiles;
rm -f ${GLOGDIR}/unextractable;
};

### Function which prints error logs ###
print_errors() {
   ### Print Unrepairable ###
   echo
   if [ -f ${GLOGDIR}/badfiles ]
   then
      echo '****************************************'
      echo '*** THE FOLLOWING WERE UNREPAIRABLE ****'
      echo '****************************************'
      echo
      cat ${GLOGDIR}/badfiles
   else
      echo 'No Unrepairable Files!'
   fi

   echo

   ### Print Unextractable ###
   if [ -f ${GLOGDIR}/unextractable ]
   then
      echo '****************************************'
      echo '*** THE FOLLOWING WERE UNEXTRACTABLE ***'
      echo '****************************************'
      echo
      cat ${GLOGDIR}/unextractable
   else
      echo 'No Unextractable Files!'
   fi
};

### Set/Clean up the Environment ###
CUR_PWD=`pwd`
cd ${DLDIR}
cleanup_logs

### The loop for subdirectories. It calls rarslave.current on every directory ##
################################################################################
find ./ -type d -print0 | xargs -0 -n1 | xargs -ISUBDIR bash -c '
    cd "SUBDIR";
    echo "################################################################################"
    echo "Working in $(pwd)";
    echo "################################################################################"
    
    rarslave.current;
    
    echo "################################################################################"
    echo "Done in $(pwd)";
    echo "################################################################################"
'
################################################################################

### Go back to old pwd ###
cd ${CUR_PWD}

### Print Parting Messages ###
print_errors
echo
echo "All Finished. Good Bye!"