简体   繁体   中英

duplicity - The file specification … can not match any files in the base directory

I am backing up some paths with duplicity to an other partition and now I want to exclude a sub directories. But I got this error:

[*] duplicity --full-if-older-than 1M --no-encryption -v4 --volsize 100 --exclude "/home/usera/gemeinfrei/epubs/**" "/home/usera" "file:///var/backups/backup/home/usera"
Import of duplicity.backends.giobackend Failed: No module named gio
Fatal Error: The file specification
    "/home/usera/gemeinfrei/epubs/**
cannot match any files in the base directory
    /home/usera
Useful file specifications begin with the base directory or some
pattern (such as '**') which matches the base directory.

It is strange because the file specification does begin with the base directory. There are also other user directories I want to backup. I run one duplicity process for each of them. Or should I use only one duplicity process which uses multiple --include options and as base directory / ?

This is the actual backup script:

#!/bin/bash

#0 Error, 2 Warning, 4 Notice (default), 8 Info, 9 Debug (noisiest)
VERBOSE=4

BACKUP_PATH=/var/backups/backup

DUP="duplicity --full-if-older-than 1M --no-encryption -v$VERBOSE --volsize 100"

DUP_DEL="duplicity remove-older-than 2M --force -v$VERBOSE"

DUP_EXCLUDE="--exclude \"/home/usera/gemeinfrei/epubs/**\""

DIRECTORIES="/etc /home/usera /home/userb /home/userc /home/userd /home/usere /home/userf /home/userg /home/userh /var/vmail"

function doBackup() {
    for DIRECTORY in $DIRECTORIES; do
        if [ -d "$DIRECTORY" ]; then
            mkdir -p "${BACKUP_PATH}${DIRECTORY}"
            if [ -d "${BACKUP_PATH}${DIRECTORY}" ]; then
                echo "[*] $DUP $DUP_EXCLUDE \"$DIRECTORY\" \"file://${BACKUP_PATH}${DIRECTORY}\""
                $DUP $DUP_EXCLUDE "$DIRECTORY" "file://${BACKUP_PATH}${DIRECTORY}"
            else
                echo "[!] Backuppfad konnte nicht angelegt werden: ${BACKUP_PATH}${DIRECTORY}"
            fi
        fi
    done
}

function doClean() {
    for DIRECTORY in $DIRECTORIES; do
        echo "[*] $DUP_DEL \"file://${BACKUP_PATH}${DIRECTORY}\""
        $DUP_DEL "file://${BACKUP_PATH}${DIRECTORY}"
    done
}

echo -n "[*] "
date
df -h

while [ -n "$1" ]; do
    case $1 in
        "backup")
            doBackup
            ;;
        "clean")
            doClean
            ;;
        *)
            echo "[*] Unbekannter Parameter: '$1'" >&2
            ;;
    esac
    shift
done

df -h
echo -n "[*] "
date

exit 0

如何在命令行上转义星号,以免它们不被扩展?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM