v1.0 - Version stable: multi-PC, détection UI-DETR-1, 3 modes exécution
- Frontend v4 accessible sur réseau local (192.168.1.40) - Ports ouverts: 3002 (frontend), 5001 (backend), 5004 (dashboard) - Ollama GPU fonctionnel - Self-healing interactif - Dashboard confiance Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
110
visual_workflow_builder/backend/stop.sh
Executable file
110
visual_workflow_builder/backend/stop.sh
Executable file
@@ -0,0 +1,110 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Stop Visual Workflow Builder Backend Server
|
||||
#
|
||||
# This script stops the Flask backend server gracefully
|
||||
#
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
PID_FILE="$SCRIPT_DIR/.server.pid"
|
||||
|
||||
# Colors for output
|
||||
GREEN='\033[0;32m'
|
||||
RED='\033[0;31m'
|
||||
YELLOW='\033[1;33m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
echo "=========================================="
|
||||
echo "Visual Workflow Builder - Stop Server"
|
||||
echo "=========================================="
|
||||
|
||||
# Check if PID file exists
|
||||
if [ ! -f "$PID_FILE" ]; then
|
||||
echo -e "${YELLOW}No server PID file found${NC}"
|
||||
echo "Server may not be running or was started manually"
|
||||
|
||||
# Try to find and kill any Flask process on port 5001
|
||||
echo "Checking for Flask processes on port 5001..."
|
||||
FLASK_PIDS=$(lsof -ti:5001 2>/dev/null)
|
||||
|
||||
if [ -z "$FLASK_PIDS" ]; then
|
||||
echo -e "${GREEN}No processes found on port 5001${NC}"
|
||||
exit 0
|
||||
else
|
||||
echo "Found processes: $FLASK_PIDS"
|
||||
echo "Killing processes..."
|
||||
kill $FLASK_PIDS 2>/dev/null
|
||||
sleep 1
|
||||
|
||||
# Force kill if still running
|
||||
REMAINING=$(lsof -ti:5001 2>/dev/null)
|
||||
if [ ! -z "$REMAINING" ]; then
|
||||
echo "Force killing remaining processes..."
|
||||
kill -9 $REMAINING 2>/dev/null
|
||||
fi
|
||||
|
||||
echo -e "${GREEN}✓ Processes stopped${NC}"
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
|
||||
# Read PID from file
|
||||
PID=$(cat "$PID_FILE")
|
||||
|
||||
# Check if process is running
|
||||
if ! ps -p $PID > /dev/null 2>&1; then
|
||||
echo -e "${YELLOW}Server process (PID: $PID) is not running${NC}"
|
||||
rm "$PID_FILE"
|
||||
|
||||
# Check if port is still in use
|
||||
PORT_PID=$(lsof -ti:5001 2>/dev/null)
|
||||
if [ ! -z "$PORT_PID" ]; then
|
||||
echo "But port 5001 is in use by PID: $PORT_PID"
|
||||
echo "Killing process on port 5001..."
|
||||
kill $PORT_PID 2>/dev/null
|
||||
sleep 1
|
||||
kill -9 $PORT_PID 2>/dev/null
|
||||
fi
|
||||
|
||||
echo -e "${GREEN}✓ Cleanup complete${NC}"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "Stopping server (PID: $PID)..."
|
||||
|
||||
# Try graceful shutdown first
|
||||
kill $PID 2>/dev/null
|
||||
|
||||
# Wait for process to stop (max 5 seconds)
|
||||
for i in {1..5}; do
|
||||
if ! ps -p $PID > /dev/null 2>&1; then
|
||||
echo -e "${GREEN}✓ Server stopped gracefully${NC}"
|
||||
rm "$PID_FILE"
|
||||
exit 0
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
|
||||
# Force kill if still running
|
||||
echo "Server did not stop gracefully, forcing shutdown..."
|
||||
kill -9 $PID 2>/dev/null
|
||||
|
||||
# Wait a moment
|
||||
sleep 1
|
||||
|
||||
if ps -p $PID > /dev/null 2>&1; then
|
||||
echo -e "${RED}✗ Failed to stop server${NC}"
|
||||
exit 1
|
||||
else
|
||||
echo -e "${GREEN}✓ Server stopped (forced)${NC}"
|
||||
rm "$PID_FILE"
|
||||
|
||||
# Also kill any remaining processes on port 5001
|
||||
REMAINING=$(lsof -ti:5001 2>/dev/null)
|
||||
if [ ! -z "$REMAINING" ]; then
|
||||
echo "Cleaning up remaining processes on port 5001..."
|
||||
kill -9 $REMAINING 2>/dev/null
|
||||
fi
|
||||
|
||||
exit 0
|
||||
fi
|
||||
Reference in New Issue
Block a user