0%

Rclone使用

1、安装

1
2
3
4
5
6
7
8
9
10
11
[root@VM-12-16-centos backup]# rclone --version
rclone v1.62.2
- os/version: centos 7.6.1810 (64 bit)
- os/kernel: 3.10.0-1160.71.1.el7.x86_64 (x86_64)
- os/type: linux
- os/arch: amd64
- go/version: go1.20.2
- go/linking: static
- go/tags: none

curl https://rclone.org/install.sh | sudo bash

2、配置 Webdav

1
2
3
4
5
6
7
8
vim /root/~/.config/rclone/rclone.conf

[webdav]
type = webdav
url =
vendor = other
user = admin
pass =

3、挂载本地并配置开机自启

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
vim /etc/systemd/system/rclone.service

[Unit]
Description=Rclone
After=network-online.target

[Service]
Type=simple
User=root
ExecStart=/usr/bin/rclone mount webdav:/backup /backup --cache-dir /tmp --allow-other --allow-non-empty --vfs-cache-mode writes --no-check-certificate
Restart=on-abort

[Install]
WantedBy=multi-user.target


systemctl enable rclone

systemctl status rclone

4、同步目录

1
rclone -P --ignore-existing -u -v -P --transfers=10 --ignore-errors --buffer-size=200M --check-first --checkers=10 sync ./backup/ webdav:/backup

5、解除挂载

1
fusermount -zu /backup

6、上传文件

1
2
3
4
5
6
rclone --ignore-existing --use-server-modtime    -P --transfers=10  --drive-chunk-size 10M --fast-list  --buffer-size=100M --multi-thread-streams 0  copy --check-first --checkers=10  --retries 2 --log-file rclone.log   --log-level INFO --timeout 6h  --contimeout 6h /backup/$(date +%F)/data.tar.gz webdav:/hkbak/$(date +%F)/


rclone --ignore-existing --use-server-modtime -P --transfers=10 --drive-chunk-size 10M --fast-list --buffer-size=100M --multi-thread-streams 0 copy --check-first --checkers=10 --retries 2 --log-level INFO --timeout 6h --contimeout 6h /backup/$(date +%F) webdav:/hkbak/$(date +%F)

rclone --ignore-existing --use-server-modtime -P --transfers=10 --drive-chunk-size 10M --fast-list --buffer-size=10M --multi-thread-streams 0 copy --check-first --checkers=10 --retries 2 --log-file rclone.log --log-level DEBUG --timeout 6h --contimeout 6h /backup/$(date +%F) webdav:/ctguswzl/$(date +%F)

7、错误

2023/04/17 15:33:43 Failed to copy: Locked: 423 Locked

rclone delete 00fusheng: –include-from /mnt/yingmeiju.txt -v -P

rclone –ignore-checksum –ignore-size –ignore-existing –use-server-modtime -P –transfers=2 –drive-chunk-size 10M –fast-list –buffer-size=32M –multi-thread-streams 0 copy –check-first –checkers=10 –retries 10 –low-level-retries 1000 –log-file /backup/$(date +%F)/rclone.log –log-level DEBUG –timeout 24h –contimeout 24h –tpslimit 10 /backup/$(date +%F) webdav:/hkbak/$(date +%F)

rclone –ignore-existing –use-server-modtime -P –transfers=10 –drive-chunk-size 10M –fast-list –buffer-size=100M –multi-thread-streams 0 –retries 30 –log-file /backup/$(date +%F)/rclone.log –log-level DEBUG –timeout 12h –contimeout 12h /backup/$(date +%F) webdav:/hkbak/$(date +%F)

curl -s -H ‘Authorization:Basic ZWxhc3RpYzpja3ZAMjAyMA==’ -H ‘Content-Type:application/json’ -XGET ‘http://9.150.197.156:9200/alarm_store2023-04-17/_search' -d ‘{“size”:100,”query”:{“bool”:{“must”:[{“terms”:{“alarm_type”:[“bid_capacity_full”,”bid_capacity_overload”,”bid_have_fatal_errcode”,”bid_availability_very_low”]}},{“terms”:{“region”:[“musicsz”,”musicsh”]}}]}}}’

1
2
3
 find /data/ -type d -exec chmod 755 {} \;
find /data/ -type f -exec chmod 644 {} \;
find . -name '*.sh' -type f -exec chmod +x {} \;
iBoy wechat
欢迎您扫一扫上面的微信公众号,订阅我的博客!