设置 rclone bisync

问题描述 投票:0回答:1

我正在设置

rclone
以将本地文件夹双同步到 GoogleDrive。

它已启动并运行,我可以将 GoogleDrive 挂载到文件夹中。

我已经将 GoogleDrive 的内容复制到我想要双同步的文件夹中,现在我需要启动双同步。

我试过了

# rclone bisync GoogleDrive: /srv/GoogleDrive/ --dry-run --resync --verbose

但是日志让它看起来像是要复制所有数据——这是不必要的,因为我已经获得了所有文件,并且它将删除本地和远程副本中都存在的文件夹。

例如:

NOTICE: My Drive/Papers/FSMs/mp/12.mps: Skipped delete as --dry-run is set (size 7.271Ki)

但是这个文件在本地和我的 GoogleDrive 中都存在,不需要做任何事情。

2024/01/05 21:00:57 INFO  : Bisync successful
2024/01/05 21:00:57 NOTICE:
Transferred:      129.888 GiB / 129.888 GiB, 100%, 1.386 GiB/s, ETA 0s
Checks:             25612 / 25612, 100%
Deleted:            25612 (files), 3307 (dirs)
Transferred:        51147 / 51147, 100%
Elapsed time:     58m27.3s

129BG 是无稽之谈,因为没有什么需要复制。

发生什么事了?

rclone
1个回答
0
投票

bisync
是胡说八道:它不起作用。

这似乎工作正常。

daysAgo () {
        if [ -z "$1" ] || [ $1 -gt $( date -d "-1 day" +%s ) ]; then
                echo "1"
                return
        fi

        n=2
        while [ $1 -le $( date -d "-$n days" +%s ) ]; do
                n=$( echo "$n + 1" | bc )
        done
        echo $n
}

if [ -z "$1" ] ||[ "$1" = "down" ]; then
        echo "down"
        last=$( grep down /var/lib/rclone-log | head -1 )
        if [ ! -z "$last" ]; then
                d=$( echo "$last" | cut -d ' ' -f 2 )
                dn=$( daysAgo $d )
                last="--max-age ${dn}d"
                sed -i "s/down.*/down $(date -d '-1 hour' +%s) sed/g" /var/lib/rclone-log
        else
                last=""
                echo "down $(date -d '-1 hour' +%s) echo" >> /var/lib/rclone-log
        fi
        rclone sync GoogleDrive: /mnt/space/GoogleDrive/My\ Drive/ $last --verbose
fi

if [ -z "$1" ] || [ "$1" = "up" ]; then
        echo "up"
        last=$( grep up /var/lib/rclone-log | head -1 )
        if [ ! -z "$last" ]; then
                d=$( echo "$last" | cut -d ' ' -f 2 )
                dn=$( daysAgo $d )
                last="--max-age ${dn}d"
                sed -i "s/up.*/up $(date -d '-1 hour' +%s) sed/g" /var/lib/rclone-log
        else
                last=""
                echo "up $(date -d '-1 hour' +%s) sed" >> /var/lib/rclone-log
        fi
        rclone sync /mnt/space/GoogleDrive/My\ Drive/ GoogleDrive: $last --verbose

fi
© www.soinside.com 2019 - 2024. All rights reserved.