自动同步: 2026-05-10 02:10
This commit is contained in:
+38
-38
@@ -7,7 +7,7 @@
|
||||
"name": "backup-openclaw-json",
|
||||
"enabled": true,
|
||||
"createdAtMs": 1772261581796,
|
||||
"updatedAtMs": 1778263277304,
|
||||
"updatedAtMs": 1778349605933,
|
||||
"schedule": {
|
||||
"kind": "cron",
|
||||
"expr": "0 2 * * *",
|
||||
@@ -23,10 +23,10 @@
|
||||
"mode": "announce"
|
||||
},
|
||||
"state": {
|
||||
"nextRunAtMs": 1778349600000,
|
||||
"lastRunAtMs": 1778263200006,
|
||||
"nextRunAtMs": 1778436000000,
|
||||
"lastRunAtMs": 1778349600004,
|
||||
"lastStatus": "ok",
|
||||
"lastDurationMs": 77298,
|
||||
"lastDurationMs": 5929,
|
||||
"consecutiveErrors": 0,
|
||||
"lastRunStatus": "ok",
|
||||
"lastDelivered": true,
|
||||
@@ -59,7 +59,8 @@
|
||||
"consecutiveErrors": 0,
|
||||
"lastRunStatus": "ok",
|
||||
"lastDeliveryStatus": "delivered",
|
||||
"lastDelivered": true
|
||||
"lastDelivered": true,
|
||||
"runningAtMs": 1778350200005
|
||||
},
|
||||
"delivery": {
|
||||
"mode": "announce"
|
||||
@@ -71,7 +72,7 @@
|
||||
"name": "capability-evolver-daily",
|
||||
"enabled": true,
|
||||
"createdAtMs": 1772550743528,
|
||||
"updatedAtMs": 1778178076708,
|
||||
"updatedAtMs": 1778264446939,
|
||||
"schedule": {
|
||||
"kind": "cron",
|
||||
"expr": "20 2 * * *",
|
||||
@@ -92,14 +93,14 @@
|
||||
"to": "feishu-pm"
|
||||
},
|
||||
"state": {
|
||||
"nextRunAtMs": 1778264400000,
|
||||
"lastRunAtMs": 1778178000005,
|
||||
"nextRunAtMs": 1778350800000,
|
||||
"lastRunAtMs": 1778264400005,
|
||||
"lastStatus": "error",
|
||||
"lastDurationMs": 76703,
|
||||
"consecutiveErrors": 37,
|
||||
"lastDurationMs": 46934,
|
||||
"consecutiveErrors": 38,
|
||||
"lastRunStatus": "error",
|
||||
"lastDeliveryStatus": "unknown",
|
||||
"runningAtMs": 1778264400003
|
||||
"lastError": "AxiosError: Request failed with status code 400"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -109,7 +110,7 @@
|
||||
"description": "每天凌晨2:30整理昨天的已完成任务到每日回顾",
|
||||
"enabled": true,
|
||||
"createdAtMs": 1741484880000,
|
||||
"updatedAtMs": 1778178720037,
|
||||
"updatedAtMs": 1778265114037,
|
||||
"schedule": {
|
||||
"kind": "cron",
|
||||
"expr": "30 2 * * *",
|
||||
@@ -127,15 +128,14 @@
|
||||
"channel": "last"
|
||||
},
|
||||
"state": {
|
||||
"nextRunAtMs": 1778265000000,
|
||||
"lastRunAtMs": 1778178600003,
|
||||
"lastRunStatus": "error",
|
||||
"lastStatus": "error",
|
||||
"lastDurationMs": 120034,
|
||||
"lastDeliveryStatus": "unknown",
|
||||
"consecutiveErrors": 1,
|
||||
"lastError": "cron: job execution timed out",
|
||||
"lastErrorReason": "timeout"
|
||||
"nextRunAtMs": 1778351400000,
|
||||
"lastRunAtMs": 1778265000006,
|
||||
"lastRunStatus": "ok",
|
||||
"lastStatus": "ok",
|
||||
"lastDurationMs": 114031,
|
||||
"lastDeliveryStatus": "delivered",
|
||||
"consecutiveErrors": 0,
|
||||
"lastDelivered": true
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -144,7 +144,7 @@
|
||||
"name": "zq_workspace_sync",
|
||||
"enabled": true,
|
||||
"createdAtMs": 1772551807455,
|
||||
"updatedAtMs": 1778179200010,
|
||||
"updatedAtMs": 1778265600008,
|
||||
"schedule": {
|
||||
"expr": "40 2 * * *",
|
||||
"kind": "cron",
|
||||
@@ -157,10 +157,10 @@
|
||||
"text": "执行 zq 工作区同步:bash ~/.openclaw/cron/scripts/zq_workspace_sync.sh"
|
||||
},
|
||||
"state": {
|
||||
"nextRunAtMs": 1778265600000,
|
||||
"lastRunAtMs": 1778179200007,
|
||||
"nextRunAtMs": 1778352000000,
|
||||
"lastRunAtMs": 1778265600003,
|
||||
"lastStatus": "skipped",
|
||||
"lastDurationMs": 3,
|
||||
"lastDurationMs": 5,
|
||||
"consecutiveErrors": 0,
|
||||
"lastRunStatus": "skipped",
|
||||
"lastDeliveryStatus": "not-requested",
|
||||
@@ -174,7 +174,7 @@
|
||||
"description": "每天早上8点整理与各个 AI 代理的对话记录",
|
||||
"enabled": true,
|
||||
"createdAtMs": 1772776369645,
|
||||
"updatedAtMs": 1778198479202,
|
||||
"updatedAtMs": 1778284817105,
|
||||
"schedule": {
|
||||
"kind": "cron",
|
||||
"expr": "0 8 * * *",
|
||||
@@ -192,11 +192,11 @@
|
||||
"channel": "last"
|
||||
},
|
||||
"state": {
|
||||
"nextRunAtMs": 1778284800000,
|
||||
"lastRunAtMs": 1778198400010,
|
||||
"nextRunAtMs": 1778371200000,
|
||||
"lastRunAtMs": 1778284800007,
|
||||
"lastRunStatus": "ok",
|
||||
"lastStatus": "ok",
|
||||
"lastDurationMs": 79192,
|
||||
"lastDurationMs": 17098,
|
||||
"lastDelivered": true,
|
||||
"lastDeliveryStatus": "delivered",
|
||||
"consecutiveErrors": 0
|
||||
@@ -209,7 +209,7 @@
|
||||
"description": "每天7点同步提醒到CalDAV日历",
|
||||
"enabled": true,
|
||||
"createdAtMs": 1772791528528,
|
||||
"updatedAtMs": 1778194881520,
|
||||
"updatedAtMs": 1778281278100,
|
||||
"schedule": {
|
||||
"kind": "cron",
|
||||
"expr": "0 7 * * *",
|
||||
@@ -227,11 +227,11 @@
|
||||
"channel": "last"
|
||||
},
|
||||
"state": {
|
||||
"nextRunAtMs": 1778281200000,
|
||||
"lastRunAtMs": 1778194800003,
|
||||
"nextRunAtMs": 1778367600000,
|
||||
"lastRunAtMs": 1778281200006,
|
||||
"lastRunStatus": "ok",
|
||||
"lastStatus": "ok",
|
||||
"lastDurationMs": 81517,
|
||||
"lastDurationMs": 78094,
|
||||
"lastDeliveryStatus": "delivered",
|
||||
"consecutiveErrors": 0,
|
||||
"lastDelivered": true
|
||||
@@ -350,7 +350,7 @@
|
||||
"description": "每天早上8点追踪热点新闻并推送",
|
||||
"enabled": true,
|
||||
"createdAtMs": 1774274400000,
|
||||
"updatedAtMs": 1778198659947,
|
||||
"updatedAtMs": 1778285017396,
|
||||
"schedule": {
|
||||
"kind": "cron",
|
||||
"expr": "0 8 * * *",
|
||||
@@ -368,13 +368,13 @@
|
||||
"to": "user:ou_9847ce84b960736c14554730b41e4957"
|
||||
},
|
||||
"state": {
|
||||
"nextRunAtMs": 1778284800000,
|
||||
"lastRunAtMs": 1778198479202,
|
||||
"nextRunAtMs": 1778371200000,
|
||||
"lastRunAtMs": 1778284817105,
|
||||
"lastRunStatus": "error",
|
||||
"lastStatus": "error",
|
||||
"lastDurationMs": 180745,
|
||||
"lastDurationMs": 200291,
|
||||
"lastDeliveryStatus": "delivered",
|
||||
"consecutiveErrors": 2,
|
||||
"consecutiveErrors": 3,
|
||||
"lastDelivered": true,
|
||||
"lastError": "⚠️ ✉️ Message failed"
|
||||
}
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
[2026-05-09 02:31:43] === 每日回顾整理开始 ===
|
||||
[2026-05-09 02:31:43] 处理日期: 2026-05-08
|
||||
[2026-05-09 02:31:43] 没有已完成的任务,跳过
|
||||
@@ -1,21 +1,22 @@
|
||||
#!/bin/bash
|
||||
# 每日回顾整理脚本
|
||||
# 流程:NAS pull → 整理任务 → Git commit/push → NAS sync
|
||||
# ~/work/zq 是 rclone mount 挂载点,直接读写即可,禁止 rclone sync
|
||||
# 无需 git 操作,挂载点会自动同步到 NAS
|
||||
|
||||
set -e
|
||||
|
||||
WORK_DIR="/home/starmen1265/work/zq"
|
||||
TODO_FILE="$WORK_DIR/01.待办/TODO.md"
|
||||
REVIEW_DIR="$WORK_DIR/40.归档/每日回顾"
|
||||
LOG_FILE="$HOME/work/backup/daily-review.log"
|
||||
LOG_FILE="$HOME/.openclaw/cron/logs/daily-review.log"
|
||||
|
||||
# 获取昨天的日期(格式:YYYY-MM-DD)
|
||||
YESTERDAY=$(date -d "yesterday" +%Y-%m-%d)
|
||||
REVIEW_FILE="$REVIEW_DIR/$YESTERDAY.md"
|
||||
|
||||
# 确保日志目录存在
|
||||
mkdir -p "$(dirname "$LOG_FILE")"
|
||||
# 确保目录存在
|
||||
mkdir -p "$REVIEW_DIR"
|
||||
mkdir -p "$(dirname "$LOG_FILE")"
|
||||
|
||||
log() {
|
||||
echo "[$(date '+%Y-%m-%d %H:%M:%S')] $1" | tee -a "$LOG_FILE"
|
||||
@@ -24,15 +25,11 @@ log() {
|
||||
log "=== 每日回顾整理开始 ==="
|
||||
log "处理日期: $YESTERDAY"
|
||||
|
||||
# 切换到工作目录
|
||||
cd "$WORK_DIR"
|
||||
|
||||
# 1. 先从 NAS 拉取最新内容
|
||||
log "1. 从 NAS 拉取更新..."
|
||||
rclone sync "nas-webdav:/home/Drive/工作区/张青/工作区/" "$WORK_DIR/" \
|
||||
--exclude ".git/" \
|
||||
--exclude ".gitignore" \
|
||||
--log-level INFO >> "$LOG_FILE" 2>&1
|
||||
# 检查 TODO 文件是否存在且可读
|
||||
if [ ! -f "$TODO_FILE" ]; then
|
||||
log "TODO 文件不存在,跳过"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# 如果没有已完成的任务,直接退出
|
||||
if ! grep -q "\[x\]" "$TODO_FILE"; then
|
||||
@@ -40,10 +37,9 @@ if ! grep -q "\[x\]" "$TODO_FILE"; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
log "2. 发现已完成的任务,开始整理..."
|
||||
log "1. 发现已完成的任务,开始整理..."
|
||||
|
||||
# 提取已完成的任务(保留标题结构)
|
||||
# 读取TODO.md,提取所有包含[x]的行及其所属标题
|
||||
COMPLETED_TASKS=$(awk '
|
||||
/^#/ { current_section = $0 }
|
||||
/\[x\]/ {
|
||||
@@ -55,20 +51,16 @@ COMPLETED_TASKS=$(awk '
|
||||
}
|
||||
' "$TODO_FILE")
|
||||
|
||||
# 如果每日回顾文件不存在,创建它
|
||||
if [ ! -f "$REVIEW_FILE" ]; then
|
||||
touch "$REVIEW_FILE"
|
||||
log "创建每日回顾文件: $REVIEW_FILE"
|
||||
fi
|
||||
|
||||
# 将完成的任务追加到每日回顾文件(去掉✅及后面的日期)
|
||||
# 创建每日回顾文件并写入
|
||||
log "2. 写入每日回顾: $REVIEW_FILE"
|
||||
echo "$COMPLETED_TASKS" | sed 's/ ✅ [0-9-]*$//' >> "$REVIEW_FILE"
|
||||
log "已添加任务到每日回顾"
|
||||
|
||||
# 从TODO.md中删除已完成的任务行
|
||||
sed -i '/\[x\]/d' "$TODO_FILE"
|
||||
# 从 TODO.md 中删除已完成的任务行(使用临时文件避免 sed -i 在挂载点的问题)
|
||||
log "3. 清理 TODO.md 中的已完成任务..."
|
||||
TEMP_FILE=$(mktemp)
|
||||
grep -v '\[x\]' "$TODO_FILE" > "$TEMP_FILE"
|
||||
|
||||
# 清理TODO.md中的空标题(标题下没有任务的情况)
|
||||
# 清理空标题段(标题下没有非空行的)
|
||||
awk '
|
||||
/^#/ {
|
||||
if (section_content != "") {
|
||||
@@ -88,20 +80,13 @@ awk '
|
||||
print section_content
|
||||
}
|
||||
}
|
||||
' "$TODO_FILE" > "$TODO_FILE.tmp" && mv "$TODO_FILE.tmp" "$TODO_FILE"
|
||||
' "$TEMP_FILE" > "$TEMP_FILE.cleaned"
|
||||
|
||||
# 3. 提交并推送到 Gitea
|
||||
log "3. 提交并推送到 Gitea..."
|
||||
git add "$TODO_FILE" "$REVIEW_FILE"
|
||||
git commit -m "每日回顾整理:$YESTERDAY" >> "$LOG_FILE" 2>&1 || log "Git提交无变更"
|
||||
git push origin main >> "$LOG_FILE" 2>&1 || log "警告:Git推送失败"
|
||||
|
||||
# 4. 全量同步回 NAS
|
||||
log "4. 同步回 NAS..."
|
||||
rclone sync "$WORK_DIR/" "nas-webdav:/home/Drive/工作区/张青/工作区/" \
|
||||
--exclude ".git/" \
|
||||
--exclude ".gitignore" \
|
||||
--log-level INFO >> "$LOG_FILE" 2>&1 || log "警告:rclone 推送失败"
|
||||
# 原子替换
|
||||
cat "$TEMP_FILE.cleaned" > "$TODO_FILE"
|
||||
rm -f "$TEMP_FILE" "$TEMP_FILE.cleaned"
|
||||
|
||||
# 挂载点自动同步,无需 rclone sync 或 git push
|
||||
log "4. 挂载点自动同步到 NAS,无需手动操作"
|
||||
log "=== 每日回顾整理完成 ==="
|
||||
echo "Daily review completed for $YESTERDAY"
|
||||
|
||||
Reference in New Issue
Block a user