File:  [Repository] / foxridge-archiver / archivemany.sh
Revision 1.5: download - view: text, annotated - select for diffs - revision graph
Fri Jun 23 09:58:17 2006 UTC (18 years ago) by casties
Branches: MAIN
CVS tags: HEAD
added error message for empty list file

    1: #!/bin/bash
    2: 
    3: VERSION="archivemany V0.3 (23.6.2006 ROC)"
    4: 
    5: #set -x
    6: 
    7: if [ -z "$1$2" ]
    8: then
    9:     echo $VERSION
   10:     echo "use: $0 docdir dirlist [params...]"
   11:     echo "  Archives the directories given in the file dirlist inside docdir."
   12:     exit 1
   13: fi
   14: 
   15: BASEDIR="$1"
   16: DIRLIST="$2"
   17: PARAM1="$3"
   18: PARAM2="$4"
   19: PARAM3="$5"
   20: 
   21: if [ ! -d $BASEDIR ]
   22: then
   23:     echo "ERROR: base directory $BASEDIR not found!"
   24:     exit 1
   25: fi
   26: 
   27: if [ ! -f $DIRLIST ]
   28: then
   29:     echo "ERROR: directory list file $DIRLIST not found!"
   30:     exit 1
   31: fi
   32: 
   33: CNT=0
   34: 
   35: # read directories from DIRLIST
   36: while read DIR
   37: do
   38:     CNT=$(( $CNT + 1 ))
   39:     if [ -d "$BASEDIR/$DIR" ]
   40:     then
   41: 	echo "archiving document $CNT: $DIR..."
   42: 	if /usr/local/mpiwg/archive/archiver "$PARAM1" "$PARAM2" "$PARAM3" "$BASEDIR/$DIR"
   43: 	then
   44: 	    echo "  done on `date`"
   45: 	else
   46: 	    echo "FAILED!"
   47: 	    # abort?
   48: 	fi
   49:     else
   50: 	echo "$CNT ERROR: document directory $BASEDIR/$DIR not found!"
   51:     fi
   52: done < $DIRLIST
   53: 
   54: if [ $CNT = 0 ]
   55: then
   56:     echo "ERROR: the list file $DIRLIST seems to be empty!"
   57: fi

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>