# Workspace Scripts Cross-project utility scripts that don't belong in any single app. **Rule:** App-specific CLI tools go IN THE PROJECT. These are only for cross-cutting concerns. --- ## Scripts ### `web-monitor.sh` **What:** Monitors local web apps and auto-restarts if down **Runs:** Via cron every 5 minutes **Monitors:** - Port 3000: gantt-board - Port 3003: blog-backup - Port 3005: heartbeat-monitor **Features:** - HTTP health checks (expects 200) - Automatic process kill + restart - Post-restart verification - Lock file prevents concurrent runs - Logs to: `memory/web-monitor.log` **Usage:** ```bash # Manual run ./scripts/web-monitor.sh # View logs tail -f memory/web-monitor.log ``` --- ### `daily-backup.sh` **What:** Commits data files from all web apps to Git **Runs:** Daily via cron **Backs up:** - gantt-board/data/ - blog-backup/data/ - heartbeat-monitor/data/ **Features:** - Only commits if data changed - Auto-pushes to Gitea - Logs to: `memory/backup.log` **Usage:** ```bash ./scripts/daily-backup.sh ``` --- ### `resource-monitor.sh` **What:** Monitors system resources for running web apps **Runs:** Manual (for debugging) **Monitors:** - CPU usage (>80% warns) - Memory usage (>500MB warns) - File descriptors (>900 warns) - System free memory (<500MB warns) **Usage:** ```bash # Start monitoring in background ./scripts/resource-monitor.sh # View logs tail -f logs/process-monitor.log # Stop kill $(cat /tmp/process-monitor.pid) ``` --- ### `create_ios_project.sh` **What:** Creates a new iOS SwiftUI project from Xcode template **Usage:** ```bash ./scripts/create_ios_project.sh MyNewApp ``` **Features:** - Uses Apple SwiftUI template - Sets bundle ID to `com.mattbruce.` - Sets deployment target to iOS 17.0 - Creates in `~/Documents/Projects/iPhone/OpenClaw/` --- ## Deprecated / Removed The following were duplicates and have been deleted: - ~~monitor-web-apps.sh~~ → use web-monitor.sh - ~~monitor_web_apps.sh~~ → use web-monitor.sh - ~~webapp-monitor.sh~~ → use web-monitor.sh --- ## Cron Setup These run automatically via cron. To check/edit: ```bash crontab -e ``` Current entries: ``` */5 * * * * cd /Users/mattbruce/.openclaw/workspace && ./scripts/web-monitor.sh 0 2 * * * cd /Users/mattbruce/.openclaw/workspace && ./scripts/daily-backup.sh ```