All pastes #569024 Raw Edit

Miscellany

public shellscript v1 · immutable
·published 2007-06-15 23:26 UTC
rendered paste body
i=0for PARAM in $@; doecho $icase $PARAM in-h | --help)        echo ""        echo -e "\t***Zope Backup Script***"        echo ""        echo -e "\tParameters:"        echo -e "\t[-h | --help] \tDisplays this help"        echo -e "\t[-F | --full] \tDoes a full backup (Default)"        echo -e "\t[-I | --incremental] \tDoes an incremental backup if an old backup is found, else it does a full backup."        echo -e "\t[-l | --list] \tLists the backup files"        echo -e "\t[-v | --verbose] \tVerbose mode"        exit 0;;-l | --list)        j=1        for DATABASE_FILE in `find $BACKUP_DIRECTORY -name *.fs -o -name *.fs.gz -o -name *.deltafs | sort -rM`; do                SIZE=$(stat -c "%s" $DATABASE_FILE)                NAME=`basename $DATABASE_FILE`                echo -ne "\t$j) "                echo_date_from_name $NAME                echo -n " "                echo_size $SIZE                echo -n " ($NAME : "                if [ `echo $NAME | grep 'deltafs'` ]; then                        echo "INCREMENTAL)"                else                        echo "FULL)"                fi                j=$((j+1))        done        exit 0;;-F | --full)        BACKUP="true"        INCREMENTAL_BACKUP="false";;-I | --incremental)        BACKUP="true"        INCREMENTAL_BACKUP="true";;-R | --recover)        BACKUP="false"        echo ${PARAMETERS[$((i))]}        if [ -z ${PARAMETERS[$((i+1))]} ]; then                echo "You have to specify the name of the backup file. Try '$0 --help' to get help"                exit 0        else                BACKUP_FILE=${PARAMETERS[$((i+1))]}        fi;;-v | --verbose)        OPTIONS="-v";;*)        echo "Invalid Parameter '$PARAM'. Try '$0 --help' to get help"        exit 0;;esaci=$((i+1))done