Subversion Repositories programming

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
89 irasnyd 1
#!/bin/bash
2
 
3
################## CONFIG OPTIONS ##############################################
4
DLDIR="/home/irasnyd/downloads/usenet"              # "global" download dir  ###
5
GLOGDIR="/home/irasnyd/downloads/usenet/logs"       # "global" logdir        ###
6
################################################################################
7
 
8
### Clean up global logs ###
9
cleanup_logs() {
10
rm -f ${GLOGDIR}/badfiles;
11
rm -f ${GLOGDIR}/unextractable;
12
};
13
 
14
### Function which prints error logs ###
15
print_errors() {
16
   ### Print Unrepairable ###
17
   echo
18
   if [ -f ${GLOGDIR}/badfiles ]
19
   then
20
      echo '****************************************'
21
      echo '*** THE FOLLOWING WERE UNREPAIRABLE ****'
22
      echo '****************************************'
23
      echo
24
      cat ${GLOGDIR}/badfiles
25
   else
26
      echo 'No Unrepairable Files!'
27
   fi
28
 
29
   echo
30
 
31
   ### Print Unextractable ###
32
   if [ -f ${GLOGDIR}/unextractable ]
33
   then
34
      echo '****************************************'
35
      echo '*** THE FOLLOWING WERE UNEXTRACTABLE ***'
36
      echo '****************************************'
37
      echo
38
      cat ${GLOGDIR}/unextractable
39
   else
40
      echo 'No Unextractable Files!'
41
   fi
42
};
43
 
44
### Set/Clean up the Environment ###
45
CUR_PWD=`pwd`
46
cd ${DLDIR}
47
cleanup_logs
48
 
49
### The loop for subdirectories. It calls rarslave.current on every directory ##
50
################################################################################
51
find ./ -type d -print0 | xargs -0 -n1 | xargs -ISUBDIR bash -c '
52
    cd "SUBDIR";
53
    echo "################################################################################"
54
    echo "Working in $(pwd)";
55
    echo "################################################################################"
56
 
57
    rarslave.current;
58
 
59
    echo "################################################################################"
60
    echo "Done in $(pwd)";
61
    echo "################################################################################"
62
'
63
################################################################################
64
 
65
### Go back to old pwd ###
66
cd ${CUR_PWD}
67
 
68
### Print Parting Messages ###
69
print_errors
70
echo
71
echo "All Finished. Good Bye!"