差異處
這裏顯示兩個版本的差異處。
兩邊的前次修訂版 前次修改 下次修改 | 前次修改 | ||
tech:rclone [2020/08/26 09:15] – [設定每天 2:00 執行一次] jonathan_tsai | tech:rclone [2025/04/21 19:38] (目前版本) – [使用 rclone 同步 Google Drive 檔案] jonathan | ||
---|---|---|---|
行 1: | 行 1: | ||
- | ====== | + | ====== 使用 rclone 同步 Google Drive 檔案 ====== |
因為愈來愈多檔案存放在 Google Drive, 所以要考慮一個自動的機制將檔案同步回自己的電腦主機內. | 因為愈來愈多檔案存放在 Google Drive, 所以要考慮一個自動的機制將檔案同步回自己的電腦主機內. | ||
- | | + | < |
+ | **如果需要 Docker Compose 版本可以參考** - [[tech/ | ||
+ | </ | ||
+ | ===== 安裝方式 ===== | ||
+ | ==== Alpine 3 ==== | ||
+ | | ||
+ | * 設定 cifs 掛上 NAS 目錄 : [[alpine_cifs]] | ||
+ | * < | ||
+ | apk add rclone | ||
+ | rclone version | ||
+ | </ | ||
+ | * ++看結果|< | ||
+ | pve-alpine3: | ||
+ | rclone v1.62.2-DEV | ||
+ | - os/version: alpine 3.18.6 | ||
+ | - os/kernel: 6.1.84-0-lts (x86_64) | ||
+ | - os/type: linux | ||
+ | - os/arch: amd64 | ||
+ | - go/version: go1.20.11 | ||
+ | - go/linking: static | ||
+ | - go/tags: none | ||
+ | </ | ||
- | ===== 安裝 rclone 方式 ===== | + | ==== CentOS 7 ==== |
+ | * 安裝環境 : CentOS Linux release 7.7.1908 (Core) | ||
* 安裝相關套件 <code sh> | * 安裝相關套件 <code sh> | ||
yum install curl unzip man-db | yum install curl unzip man-db | ||
行 14: | 行 36: | ||
* 安裝成功後可以下以下指令確認版本 <code sh> | * 安裝成功後可以下以下指令確認版本 <code sh> | ||
rclone version | rclone version | ||
- | </ | + | </ |
+ | * ++看結果|<cli> | ||
[root@ct-cloudsync ~]# rclone version | [root@ct-cloudsync ~]# rclone version | ||
rclone v1.50.1 | rclone v1.50.1 | ||
- os/arch: linux/amd64 | - os/arch: linux/amd64 | ||
- go version: go1.13.4 | - go version: go1.13.4 | ||
- | </file> | + | </cli>++ |
===== 設定 rclone 對 Google Drive / Photos Library API 的 config ===== | ===== 設定 rclone 對 Google Drive / Photos Library API 的 config ===== | ||
行 33: | 行 56: | ||
- name> (設定這個遠端連結定義名稱) Exp. JonathanGooglePhotos | - name> (設定這個遠端連結定義名稱) Exp. JonathanGooglePhotos | ||
- Storage> (選擇 Cloud Storage 類型) | - Storage> (選擇 Cloud Storage 類型) | ||
- | - 如果是 Google Drive 就要選 -> **13 Google Drive** | + | - 如果是 Google Drive 就要選 -> **15 Google Drive** |
- | - 如果是要同步 Google 相簿 就要選 -> **14 Google Photos** | + | - 如果是要同步 Google 相簿 就要選 -> **16 Google Photos** |
- client_id> | - client_id> | ||
- client_secret> | - client_secret> | ||
行 71: | 行 94: | ||
0 2 * * * root rclone copy --max-age 48h --no-traverse -v JonathanGooglePhotos:/ | 0 2 * * * root rclone copy --max-age 48h --no-traverse -v JonathanGooglePhotos:/ | ||
</ | </ | ||
+ | </ | ||
+ | |||
+ | <note tip> | ||
+ | * 如果要改用 webhook 方式進行通知(Exp. Discord, Teams...) | ||
+ | - 先安裝 bash, jq 與 curl Exp. <cli> | ||
+ | apk add bash jq curl | ||
+ | </ | ||
+ | - 下載 [[https:// | ||
+ | curl -o / | ||
+ | chmod a+x / | ||
+ | </ | ||
+ | - 將 crontab 內容改成< | ||
+ | : | ||
+ | 0 2 * * * root rclone copy --max-age 48h --no-traverse -v JonathanGooglePhotos:/ | ||
+ | |||
+ | </ | ||
</ | </ | ||
===== 更新 rclone 方式 ===== | ===== 更新 rclone 方式 ===== | ||
行 89: | 行 128: | ||
0 old database entries were purged. | 0 old database entries were purged. | ||
- | rclone v1.48.0 has successfully installed. | + | rclone v1.54.0 has successfully installed. |
Now run " | Now run " | ||
</ | </ | ||
+ | |||
+ | |||
+ | ===== 啟用 rclone WebUI ===== | ||
+ | * 只要加上 rcd --rc-web-gui 就可以啟動 Web UI 的服務 | ||
+ | * 如果要外部電腦也可以使用 Web UI 就要加上 --rc-addr 0.0.0.0: | ||
+ | * 再加上登入帳號密碼 Exp. --rc-user admin --rc-pass " | ||
+ | * Exp. <cli> | ||
+ | rclone rcd --rc-web-gui --rc-addr 0.0.0.0: | ||
+ | </ | ||