- 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>
54 lines
1.2 KiB
Bash
Executable File
54 lines
1.2 KiB
Bash
Executable File
#!/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
|