Files
openclaw/monitor/rotate_monitor_logs.sh
Clawd Bot ca9b510922 chore: align with upstream openclaw/openclaw and overlay local additions
- Reset master to upstream/main (16,697 commits)
- Overlay 2,271 local-only files (skills, tools, workspace, configs, apps)
- Restore IDENTITY.md and USER.md templates
- Build verified, gateway running, Discord working

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-03 07:40:46 +01:00

15 lines
345 B
Bash

#!/usr/bin/env bash
set -euo pipefail
LOGDIR=/home/alex/clawd/monitor
LOGFILE=${LOGDIR}/usage.log
MAXFILES=10
mkdir -p "$LOGDIR"
# rotate if > MAXFILES
if [ -f "$LOGFILE" ]; then
ts=$(date +%s)
mv "$LOGFILE" "${LOGFILE}.${ts}"
fi
# cleanup old files
ls -1t ${LOGDIR}/usage.log.* 2>/dev/null | sed -n "$((MAXFILES+1)),999p" | xargs -r rm -f