yui_for_Cris/backup.sh
2026-03-09 23:02:49 +08:00

17 lines
435 B
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
cd /root/.openclaw/workspace
# 拉取最新代码避免冲突
git pull origin master
# 添加所有文件(除了.gitignore里的secrets.md
git add .
# 提交
git commit -m "daily backup $(date +'%Y-%m-%d %H:%M:%S')"
# 推送
git push origin master
# 检查是否成功
if [ $? -eq 0 ]; then
echo "✅ Workspace backup success $(date +'%Y-%m-%d')"
else
echo "❌ Workspace backup failed $(date +'%Y-%m-%d')"
fi