#!/bin/bash # Stop 24-hour test LOG_DIR="logs/24h_test" PID_FILE="${LOG_DIR}/mev-bot.pid" if [ ! -f "${PID_FILE}" ]; then echo "❌ No test running (PID file not found)" exit 1 fi PID=$(cat "${PID_FILE}") echo "🛑 Stopping MEV bot (PID ${PID})..." if ps -p "${PID}" > /dev/null 2>&1; then kill "${PID}" echo " Waiting for graceful shutdown..." # Wait up to 10 seconds for i in {1..10}; do if ! ps -p "${PID}" > /dev/null 2>&1; then echo "✅ Bot stopped successfully" rm -f "${PID_FILE}" exit 0 fi sleep 1 done # Force kill if still running echo "⚠️ Forcing shutdown..." kill -9 "${PID}" 2>/dev/null rm -f "${PID_FILE}" echo "✅ Bot forcefully stopped" else echo "⚠️ Bot not running, cleaning up PID file" rm -f "${PID_FILE}" fi # Generate final report echo "" echo "📊 Generating final report..." ./scripts/generate-test-report.sh