duplicity-talk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Duplicity-talk] Quotes in bash script


From: Martin Basting
Subject: [Duplicity-talk] Quotes in bash script
Date: Tue, 9 Nov 2010 11:57:37 +0100

Hello,

We have the following script:

#!/bin/bash

# name of logfile
TODAY=`date +%F`
#Which gnupg key to use for backup
ENCKEY="OurKEY"
# special duplicity options
DOPTS="--asynchronous-upload --verbosity=3"
# which servers to backup. Include vars below
SERVERS="nlweb"
# How many days to keep the backup
DKEEP="30"
# some emails settings
FROM="address@hidden"
TO="address@hidden"
SMTP="smtp.provider.com"

for SERVER in $SERVERS; do
    # some vars which need server name
    SUBJECT="${SERVER} backup log"
    LOGFILE="/tmp/$TODAY-${SERVER}-backup.log"
    GLOGFILE=${LOGFILE}.gz
    # Remove old logfiles
    rm $LOGFILE $GLOGFILE
    # All output to logfile
    exec 3>&1 4>&2 >$LOGFILE 2>&1


        case "$SERVER" in

        nlweb)
                EXCLUDES="**sess_** **civicrm/templates_c** **.no_delete**"
                SOURCE="/media/nlweb"
                DESTINATION="file:///media/backupsets/nlweb"
        ;;

        nldc01)
                EXCLUDES=""
                SOURCE="/media/nldc01"
                DESTINATION="file:///media/backupsets/nldc01"
        ;;

        nlexchange)
                EXCLUDES=""
                SOURCE="/media/nlexchange/backup"
                DESTINATION="file:///media/backupsets/nlexchange"
        ;;

        esac

    # generate excludes
        for EXCLUDE in $EXCLUDES; do
                EXC="$EXC --exclude $EXCLUDE"
        done

        duplicity --encrypt-key=${ENCKEY} ${EXC} ${DOPTS} ${SOURCE} ${DESTINATION}
        duplicity remove-older-than ${DKEEP} ${DESTINATION}
        gzip $LOGFILE
        email -r $SMTP -s "$SUBJECT" -f "$FROM" -b -a "$GLOGFILE" "$TO"

done

For some reason it ignores the quotes for the excludes. So it does not exclude our excludes. If we run the syntax manually it just runs it.
Does anyone has an idea how to get this script working?

Kind Regards,

Martin


reply via email to

[Prev in Thread] Current Thread [Next in Thread]