-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Expand file tree
/
Copy pathexample-usage.sh
More file actions
executable file
·64 lines (49 loc) · 1.79 KB
/
Copy pathexample-usage.sh
File metadata and controls
executable file
·64 lines (49 loc) · 1.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/bin/bash
# Example usage of CLI tools outside Docker environment
# This script demonstrates how to use the CLI tools in any directory
echo "=== CLI Tools Configuration Example ==="
echo
# Set custom data directory (optional)
export CLI_DATA_DIR="./monitoring-data"
# Set custom database paths (optional)
export CLI_ERROR_DB_PATH="./monitoring-data/runtime-errors.db"
export CLI_LOG_DB_PATH="./monitoring-data/process-logs.db"
echo "Data directory: $CLI_DATA_DIR"
echo "Error database: $CLI_ERROR_DB_PATH"
echo "Log database: $CLI_LOG_DB_PATH"
echo
# Example: Start monitoring a process
echo "=== Starting Process Monitor ==="
bun run cli-tools.ts process start --instance-id "my-app" --port 3000 -- npm run dev &
MONITOR_PID=$!
# Wait a bit for the process to start
sleep 2
# Example: Check process status
echo "=== Process Status ==="
bun run cli-tools.ts process status --instance-id "my-app"
echo
# Example: List recent errors
echo "=== Recent Errors ==="
bun run cli-tools.ts errors list --instance-id "my-app" --limit 10 --format table
echo
# Example: Get recent logs
echo "=== Recent Logs ==="
bun run cli-tools.ts logs get --instance-id "my-app" --format raw
echo
# Example: Get error statistics
echo "=== Error Statistics ==="
bun run cli-tools.ts errors stats --instance-id "my-app"
echo
# Example: Get log statistics
echo "=== Log Statistics ==="
bun run cli-tools.ts logs stats --instance-id "my-app"
echo
# Example: Get all logs and reset (useful for periodic log collection)
echo "=== All Logs (and reset) ==="
bun run cli-tools.ts logs get --instance-id "my-app" --format raw --reset > collected-logs.txt
echo "Logs saved to collected-logs.txt"
echo
# Cleanup: Stop the monitor
echo "=== Stopping Monitor ==="
bun run cli-tools.ts process stop --instance-id "my-app"
echo "=== Example Complete ==="