feat: 初始化 iCloud 照片自动同步项目

This commit is contained in:
CHE LIANG ZHAO
2026-01-28 13:48:59 +08:00
commit 4c61fc6a3a
5 changed files with 177 additions and 0 deletions

57
icloud.sh Normal file
View File

@@ -0,0 +1,57 @@
#!/bin/bash
# iCloud 同步管理脚本
# 用法: ./icloud.sh <命令>
# 命令: auth, logs, status, restart, sync
cd "$(dirname "$0")"
show_help() {
echo -e "\033[36m用法: ./icloud.sh <命令>\033[0m"
echo ""
echo -e "\033[36m命令:\033[0m"
echo " auth - 重新认证"
echo " logs - 查看实时日志"
echo " status - 查看容器状态"
echo " restart - 重启容器"
echo " sync - 立即触发同步"
}
if [ -z "$1" ]; then
show_help
exit 0
fi
case $1 in
auth)
echo -e "\033[32m开始 iCloud 认证...\033[0m"
echo -e "\033[33m请输入密码和验证码完成认证\033[0m"
docker exec -it icloudpd sync-icloud.sh --Initialise
if [ $? -eq 0 ]; then
echo -e "\033[32m认证成功\033[0m"
else
echo -e "\033[31m认证失败请重试\033[0m"
fi
;;
logs)
echo -e "\033[36m查看实时日志 (Ctrl+C 退出)...\033[0m"
docker logs -f icloudpd
;;
status)
docker ps --filter "name=icloudpd" --format "table {{.Status}}\t{{.Ports}}"
docker logs --tail 10 icloudpd
;;
restart)
echo -e "\033[33m重启容器...\033[0m"
docker compose restart
echo -e "\033[32m完成\033[0m"
;;
sync)
echo -e "\033[33m立即触发同步...\033[0m"
docker exec icloudpd sync-icloud.sh --DownloadOnce
;;
*)
echo -e "\033[31m未知命令: $1\033[0m"
echo ""
show_help
;;
esac