差異處

這裏顯示兩個版本的差異處。

連向這個比對檢視

兩邊的前次修訂版 前次修改
下次修改
前次修改
tech:rclone [2021/02/27 22:38] jonathantech:rclone [2025/03/17 13:12] (目前版本) – [設定每天 2:00 執行一次] jonathan
行 1: 行 1:
-====== CentOS7 使用 rclone 同步 Google Drive 檔案 ======+====== 使用 rclone 同步 Google Drive 檔案 ======
  
 因為愈來愈多檔案存放在 Google Drive, 所以要考慮一個自動的機制將檔案同步回自己的電腦主機內. 因為愈來愈多檔案存放在 Google Drive, 所以要考慮一個自動的機制將檔案同步回自己的電腦主機內.
  
-  * 安裝環境 : CentOS Linux release 7.7.1908 (Core)+===== 安裝方式 ===== 
 +==== Alpine 3 ==== 
 +  * 安裝環境 : Alpine Linux 3.18 
 +  * 設定 cifs 掛上 NAS 目錄 : [[alpine_cifs]]  
 +  * <cli> 
 +apk add rclone 
 +rclone version 
 +</cli> 
 +    * ++看結果|<cli> 
 +pve-alpine3:~# rclone version 
 +rclone v1.62.2-DEV 
 +- os/version: alpine 3.18.6 (64 bit) 
 +- 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 
 +</cli>++
  
-===== 安裝 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: 行 33:
   * 安裝成功後可以下以下指令確認版本 <code sh>   * 安裝成功後可以下以下指令確認版本 <code sh>
 rclone version rclone version
-</code><file>+</code> 
 +    * ++看結果|<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 =====
行 71: 行 91:
 0 2 * * * root rclone copy --max-age 48h --no-traverse -v JonathanGooglePhotos:/ /nas_Photos/GooglePhotos/ 2>&1 | tee /tmp/syncGooglePhotos.log ; cat /tmp/syncGooglePhotos.log | mail -s "RClone Sync Log" [email protected] 0 2 * * * root rclone copy --max-age 48h --no-traverse -v JonathanGooglePhotos:/ /nas_Photos/GooglePhotos/ 2>&1 | tee /tmp/syncGooglePhotos.log ; cat /tmp/syncGooglePhotos.log | mail -s "RClone Sync Log" [email protected]
 </file> </file>
 +</note>
 +
 +<note tip>
 +  * 如果要改用 webhook 方式進行通知(Exp. Discord, Teams...)
 +    - 先安裝 bash, jq 與 curl Exp. <cli>
 +apk add bash jq curl
 +</cli>
 +    - 下載 [[https://raw.githubusercontent.com/tryweb/docker-compose/refs/heads/main/scripts/send_logs_to_discord.sh|send_logs_to_discord.sh]]<cli>
 +curl -o /usr/local/bin/send_logs_to_discord.sh https://raw.githubusercontent.com/tryweb/docker-compose/refs/heads/main/scripts/send_logs_to_discord.sh
 +chmod a+x /usr/local/bin/send_logs_to_discord.sh
 +</cli>
 +    - 將 crontab 內容改成<file>
 +:
 +0 2 * * * root rclone copy --max-age 48h --no-traverse -v JonathanGooglePhotos:/ /nas_Photos/GooglePhotos/ 2>&1 | tee /tmp/syncGooglePhotos.log && send_logs_to_discord.sh TITLE="RClone sync Google Photos..." LOG_FILE="/tmp/syncGooglePhotos.log" WEBHOOK_URL="https://discord.com/api/webhooks/13xxxxxxxxxxxxxxx28/Wxxxxxy-hkxxxxxxxxxxxxxxxxxxxxIOsyuGjyaqxxxxxxxxxxxxxxxxxxxxNJ0kYFnC"
 +
 +</file>  
 </note> </note>
 ===== 更新 rclone 方式 ===== ===== 更新 rclone 方式 =====
  • tech/rclone.1614436716.txt.gz
  • 上一次變更: 2021/02/27 22:38
  • jonathan