test-repo/scripts/README.md
Matt Bruce 6ddac4a21c Clean up workspace scripts folder
- Removed duplicate monitoring scripts (4 versions consolidated to 1)
- Moved gantt-specific scripts to gantt-board project repo
- Moved create_ios_project.sh into scripts/
- Moved monitor-processes.sh into scripts/ as resource-monitor.sh
- Deleted monitor-restart.sh (duplicate)
- Created README.md documenting what's left and why
2026-02-21 17:21:50 -06:00

116 lines
2.3 KiB
Markdown

# 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.<appname>`
- 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
```