无法通过 ssh 使用 rsync 在备份脚本中找到错误

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

我正在尝试制作一个简单的 bash 脚本来通过 ssh 将我的 /home 与家庭服务器同步(以便能够进一步使用)。 我想排除一些文件夹,但它们没有被排除...也许我在语法上犯了错误,但我看不出是什么...

#!/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!'

不要在排除中使用“/home/viktor”:

#!/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!'