简体   繁体   中英

can't find fault in backup script with rsync over ssh

I'm trying to make a simple bash script to sync my /home with a home server over ssh (to be able to use from further as well). I want to exclude some folders, but they're not being excluded... Maybe I made a mistake in the syntax, but i don't see what...

#!/usr/bin/bash

## This is my backup script

# Make lists of some folders i won't be syncing
ls /storage/Music > /home/viktor/Music-storage.list
ls /storage/Videos > /home/viktor/Videos-storage.list
ls /storage/Downloads > /home/viktor/Downloads-storage.list

rsync --verbose --archive --compress --delete \
    --exclude="/home/viktor/.local/share/Trash/*" \
    --exclude="/home/viktor/.local/share/baloo/index" \
    --exclude="/home/viktor/.var/com.valvesoftware.Steam/*" \
    --exclude="/home/viktor/.var/app/com.usebottles.bottles/data/bottles/bottles/GamingBottle/*" \
    --log-file="/home/viktor/backupsync.log" \
    --rsh='sudo ssh -i (omitted but ssh works)' \
    /home/viktor viktor@192.168.1.35:/mnt/md/backuparray

echo 'syncing is klaar!'

Don't use "/home/viktor" in the exclude:

#!/usr/bin/bash

## This is my backup script

# Make lists of some folders i won't be syncing
ls /storage/Music > /home/viktor/Music-storage.list
ls /storage/Videos > /home/viktor/Videos-storage.list
ls /storage/Downloads > /home/viktor/Downloads-storage.list

rsync --verbose --archive --compress --delete \
    --exclude=".local/share/Trash/*" \
    --exclude=".local/share/baloo/index" \
    --exclude=".var/com.valvesoftware.Steam/*" \
    --exclude=".var/app/com.usebottles.bottles/data/bottles/bottles/GamingBottle/*" \
    --log-file="/home/viktor/backupsync.log" \
    --rsh='sudo ssh -i (omitted but ssh works)' \
    /home/viktor viktor@192.168.1.35:/mnt/md/backuparray

echo 'syncing is klaar!'

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