chore: move cron scripts to ~/.openclaw/cron/scripts
- Move scripts from ~/work/backup/ to ~/.openclaw/cron/scripts/ - Update cron jobs.json to use new script paths - Scripts: backup_openclaw.sh, evolver-run.sh, zq-sync.sh, git-auto-sync.sh, ai-conversation-logger.sh
This commit is contained in:
Executable
+43
@@ -0,0 +1,43 @@
|
||||
#!/bin/bash
|
||||
# 知识库同步和备份脚本
|
||||
|
||||
ZQ_DIR="$HOME/work/zq"
|
||||
LOG_FILE="$HOME/work/zq-sync.log"
|
||||
DATE=$(date '+%Y-%m-%d %H:%M:%S')
|
||||
|
||||
log() {
|
||||
echo "[$DATE] $1" >> "$LOG_FILE"
|
||||
}
|
||||
|
||||
log "========== 开始同步 =========="
|
||||
|
||||
cd "$ZQ_DIR" || exit 1
|
||||
|
||||
# 1. 先拉取远程更新
|
||||
log "拉取远程更新..."
|
||||
git pull origin main --rebase >> "$LOG_FILE" 2>&1
|
||||
|
||||
# 2. 从 NAS WebDAV 拉取最新内容(排除 .git 目录)
|
||||
log "从 NAS 拉取更新..."
|
||||
rclone sync "nas-webdav:/home/Drive/工作区/张青/工作区/" "$ZQ_DIR/" \
|
||||
--exclude ".git/" \
|
||||
--exclude ".gitignore" \
|
||||
--log-level INFO >> "$LOG_FILE" 2>&1
|
||||
|
||||
# 3. 检查是否有变更
|
||||
CHANGES=$(git status --porcelain)
|
||||
|
||||
if [ -n "$CHANGES" ]; then
|
||||
log "检测到变更,提交到 Git..."
|
||||
git add -A
|
||||
git commit -m "自动备份: $DATE" >> "$LOG_FILE" 2>&1
|
||||
|
||||
# 4. 推送到 Gitea
|
||||
log "推送到 Gitea..."
|
||||
git push origin main >> "$LOG_FILE" 2>&1
|
||||
log "备份完成!"
|
||||
else
|
||||
log "没有变更,跳过提交。"
|
||||
fi
|
||||
|
||||
log "========== 同步完成 =========="
|
||||
Reference in New Issue
Block a user