feat: sync current progress (P0 hardening + P1 observability + deploy docs/systemd)

This commit is contained in:
OpenClaw Agent
2026-02-28 23:51:23 +08:00
commit d17296d794
96 changed files with 6358 additions and 0 deletions

18
scripts/backup_db.sh Executable file
View File

@@ -0,0 +1,18 @@
#!/usr/bin/env bash
set -euo pipefail
DB_PATH=${DB_PATH:-/root/.openclaw/workspace/asset-tracker/data/asset-tracker.db}
BACKUP_DIR=${BACKUP_DIR:-/root/.openclaw/workspace/asset-tracker/backups}
TS=$(date +%Y%m%d_%H%M%S)
mkdir -p "$BACKUP_DIR"
if [ ! -f "$DB_PATH" ]; then
echo "db not found: $DB_PATH" >&2
exit 1
fi
OUT="$BACKUP_DIR/asset-tracker-$TS.db"
cp "$DB_PATH" "$OUT"
gzip -f "$OUT"
echo "backup created: $OUT.gz"

23
scripts/restore_db.sh Executable file
View File

@@ -0,0 +1,23 @@
#!/usr/bin/env bash
set -euo pipefail
if [ $# -lt 1 ]; then
echo "usage: $0 <backup.db.gz|backup.db> [target_db_path]" >&2
exit 1
fi
SRC=$1
TARGET=${2:-/root/.openclaw/workspace/asset-tracker/data/asset-tracker.db}
TMP=$(mktemp -d)
trap 'rm -rf "$TMP"' EXIT
mkdir -p "$(dirname "$TARGET")"
if [[ "$SRC" == *.gz ]]; then
gunzip -c "$SRC" > "$TMP/restore.db"
else
cp "$SRC" "$TMP/restore.db"
fi
cp "$TMP/restore.db" "$TARGET"
echo "restored to: $TARGET"