openclaw / start.sh
bhgi's picture
Add startup script with auto-backup
296a0dc verified
raw
history blame contribute delete
673 Bytes
#!/bin/bash
# 持久化恢复:从 /mnt/workspace 恢复 OpenClaw 配置
if [ -d "/mnt/workspace/.openclaw" ]; then
echo "Restoring OpenClaw config from /mnt/workspace..."
mkdir -p /root/.openclaw
cp -r /mnt/workspace/.openclaw/* /root/.openclaw/ 2>/dev/null
echo "Config restored!"
fi
# 设置定时备份任务(每5分钟备份一次)
(crontab -l 2>/dev/null; echo "*/5 * * * * mkdir -p /mnt/workspace/.openclaw && cp -r /root/.openclaw/* /mnt/workspace/.openclaw/ 2>/dev/null") | crontab -
service cron start 2>/dev/null || cron 2>/dev/null
echo "Auto-backup cron job set up (every 5 minutes)"
# 调用原始 entrypoint
exec /entrypoint.sh "$@"