兩邊的前次修訂版 前次修改
下次修改 | 前次修改
|
tech:rclone [2025/03/04 05:32] – [設定每天 2:00 執行一次] webook 通知 jonathan | tech:rclone [2025/03/17 13:12] (目前版本) – [設定每天 2:00 執行一次] jonathan |
---|
| |
<note tip> | <note tip> |
* 如果要改用 webhook 方式進行通知(Exp. Discord, Teams...), 可以先安裝 jq 與 curl 將 crontab 內容改成<file> | * 如果要改用 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 && LOG_CONTENT=$(cat /tmp/syncGooglePhotos.log | jq -sR .) && curl -H "Content-Type: application/json" -X POST -d "{\"content\":$LOG_CONTENT}" https://discord.com/api/webhooks/13xxxxxxxxxxxxxxxx6/yxxxxxX_GxxxJ-i_zxxxxxxxxxxpe_3xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxN_txxxa | 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> | </file> |
</note> | </note> |