Files
beads/scripts/stop-agent-mail-server.sh
Steve Yegge bbe73d54bc Add Agent Mail multi-workspace deployment guide and scripts
- docs/AGENT_MAIL_DEPLOYMENT.md: 10-step deployment plan for 13 workspaces
- docs/AGENT_MAIL_MULTI_WORKSPACE_SETUP.md: Architecture and configuration guide
- scripts/setup-agent-mail-workspace.sh: Auto-configure .envrc per workspace
- scripts/start-agent-mail-server.sh: Start Agent Mail server
- scripts/stop-agent-mail-server.sh: Stop Agent Mail server
- scripts/agent-mail-status.sh: Monitor server and all channels

Supports 3-channel setup: beads.dev, vc.dev, wyvern.dev
Ready for 0.23.0 deployment with Agent Mail integration

Amp-Thread-ID: https://ampcode.com/threads/T-bc960efb-3ddc-4635-8c8e-a42a6e9e67d9
Co-authored-by: Amp <amp@ampcode.com>
2025-11-08 04:16:44 -08:00

54 lines
1.2 KiB
Bash
Executable File
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/bash
# Stop Agent Mail server
# Usage: ./stop-agent-mail-server.sh
PID_FILE="${AGENT_MAIL_PID:-$HOME/agent-mail.pid}"
if [[ ! -f "$PID_FILE" ]]; then
echo "⚠️ No PID file found: $PID_FILE"
echo " Attempting to kill by process name..."
if pkill -f "mcp_agent_mail.cli serve-http"; then
echo "✅ Killed Agent Mail server by process name"
else
echo " No Agent Mail server process found"
fi
exit 0
fi
PID=$(cat "$PID_FILE")
if ! ps -p "$PID" > /dev/null 2>&1; then
echo "⚠️ Process $PID not running (stale PID file)"
rm -f "$PID_FILE"
exit 0
fi
echo "🛑 Stopping Agent Mail server (PID: $PID)..."
kill "$PID"
# Wait for graceful shutdown
for i in {1..5}; do
if ! ps -p "$PID" > /dev/null 2>&1; then
echo "✅ Server stopped gracefully"
rm -f "$PID_FILE"
exit 0
fi
sleep 1
done
# Force kill if needed
if ps -p "$PID" > /dev/null 2>&1; then
echo "⚠️ Server didn't stop gracefully, forcing..."
kill -9 "$PID"
sleep 1
fi
if ! ps -p "$PID" > /dev/null 2>&1; then
echo "✅ Server stopped (forced)"
rm -f "$PID_FILE"
else
echo "❌ Failed to stop server"
exit 1
fi