Add daemon management targets to Makefile
- Add 'make run' target that installs and restarts daemon from home directory - Add 'make restart' target to stop and start daemon without install - Add 'make stop' target to safely stop running daemon - Add 'make status' target to check daemon status with PID verification - Fixes issue where daemon doesn't update after 'make install' - Ensures daemon runs from .venv/bin/ to avoid stale system-wide version - Includes process verification with ps command to confirm replacement 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
8c4ea3a77f
commit
014b632517
59
Makefile
59
Makefile
|
|
@ -1,13 +1,17 @@
|
||||||
# Makefile for MCP Browser
|
# Makefile for MCP Browser
|
||||||
# Created by AI for AI development
|
# Created by AI for AI development
|
||||||
|
|
||||||
.PHONY: test install clean lint docs help
|
.PHONY: test install clean lint docs help run restart stop status
|
||||||
|
|
||||||
help:
|
help:
|
||||||
@echo "MCP Browser Development Commands"
|
@echo "MCP Browser Development Commands"
|
||||||
@echo "================================"
|
@echo "================================"
|
||||||
@echo "make test - Run all tests (unit + integration)"
|
@echo "make test - Run all tests (unit + integration)"
|
||||||
@echo "make install - Install package in development mode"
|
@echo "make install - Install package in development mode"
|
||||||
|
@echo "make run - Install and restart daemon from home directory"
|
||||||
|
@echo "make restart - Stop and restart daemon (without install)"
|
||||||
|
@echo "make stop - Stop running daemon"
|
||||||
|
@echo "make status - Show daemon status"
|
||||||
@echo "make lint - Run code quality checks"
|
@echo "make lint - Run code quality checks"
|
||||||
@echo "make docs - Generate AI-friendly documentation"
|
@echo "make docs - Generate AI-friendly documentation"
|
||||||
@echo "make clean - Remove build artifacts"
|
@echo "make clean - Remove build artifacts"
|
||||||
|
|
@ -45,4 +49,55 @@ format:
|
||||||
black mcp_browser/ mcp_servers/ tests/
|
black mcp_browser/ mcp_servers/ tests/
|
||||||
|
|
||||||
typecheck:
|
typecheck:
|
||||||
mypy mcp_browser/ --ignore-missing-imports
|
mypy mcp_browser/ --ignore-missing-imports
|
||||||
|
|
||||||
|
# Daemon management targets
|
||||||
|
status:
|
||||||
|
@echo "=== MCP Browser Daemon Status ==="
|
||||||
|
@if [ -f /tmp/mcp-browser-1004/mcp-browser.pid ]; then \
|
||||||
|
pid=$$(cat /tmp/mcp-browser-1004/mcp-browser.pid); \
|
||||||
|
echo "PID file exists: $$pid"; \
|
||||||
|
if ps -p $$pid > /dev/null 2>&1; then \
|
||||||
|
echo "✓ Daemon is running (PID: $$pid)"; \
|
||||||
|
ps -fp $$pid; \
|
||||||
|
else \
|
||||||
|
echo "✗ Daemon not running (stale PID file)"; \
|
||||||
|
fi; \
|
||||||
|
else \
|
||||||
|
echo "✗ No PID file found"; \
|
||||||
|
fi
|
||||||
|
|
||||||
|
stop:
|
||||||
|
@echo "=== Stopping MCP Browser Daemon ==="
|
||||||
|
@if [ -f /tmp/mcp-browser-1004/mcp-browser.pid ]; then \
|
||||||
|
pid=$$(cat /tmp/mcp-browser-1004/mcp-browser.pid); \
|
||||||
|
echo "Stopping daemon (PID: $$pid)..."; \
|
||||||
|
if ps -p $$pid > /dev/null 2>&1; then \
|
||||||
|
kill -TERM $$pid; \
|
||||||
|
sleep 2; \
|
||||||
|
if ps -p $$pid > /dev/null 2>&1; then \
|
||||||
|
echo "Daemon still running, force killing..."; \
|
||||||
|
kill -KILL $$pid; \
|
||||||
|
fi; \
|
||||||
|
echo "✓ Daemon stopped"; \
|
||||||
|
else \
|
||||||
|
echo "Daemon was not running"; \
|
||||||
|
fi; \
|
||||||
|
rm -f /tmp/mcp-browser-1004/mcp-browser.pid; \
|
||||||
|
else \
|
||||||
|
echo "No PID file found"; \
|
||||||
|
fi
|
||||||
|
|
||||||
|
restart:
|
||||||
|
@echo "=== Restarting MCP Browser Daemon ==="
|
||||||
|
$(MAKE) stop
|
||||||
|
@echo "Starting daemon from home directory..."
|
||||||
|
@cd /mnt/data/claude/claude && nohup /mnt/data/claude/claude/.venv/bin/mcp-browser-daemon > /dev/null 2>&1 &
|
||||||
|
@sleep 3
|
||||||
|
@echo "Verifying daemon restart..."
|
||||||
|
$(MAKE) status
|
||||||
|
|
||||||
|
run:
|
||||||
|
@echo "=== Installing and Running MCP Browser Daemon ==="
|
||||||
|
$(MAKE) install
|
||||||
|
$(MAKE) restart
|
||||||
Loading…
Reference in New Issue