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

Time:11-30

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 [email protected]:/mnt/md/backuparray

echo 'syncing is klaar!'

CodePudding user response:

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 [email protected]:/mnt/md/backuparray

echo 'syncing is klaar!'
  • Related