#!/bin/bash echo "=== Force Restart Help Documentation Server ===" echo "" echo "1. Killing all nginx processes..." pkill -f nginx 2>/dev/null || true sleep 2 echo "2. Checking for remaining nginx processes..." if pgrep nginx > /dev/null; then echo " Force killing remaining nginx processes..." pkill -9 nginx 2>/dev/null || true sleep 1 fi echo "3. Checking port 6045..." lsof -i :6045 2>/dev/null || echo " Port 6045 is free" echo "" echo "4. Starting fresh nginx instance..." NGINX_BIN="/home/taoc/nginx/sbin/nginx" HELP_DOCS_DIR="/home/taoc/uft30help/" CONF_FILE="$HELP_DOCS_DIR/workspace/nginx.conf" if [ ! -f "$CONF_FILE" ]; then echo " Copying nginx configuration..." cp "$(dirname "$0")/nginx.conf" "$CONF_FILE" fi if [ ! -f "$HELP_DOCS_DIR/workspace/help.conf" ]; then echo " Copying server configuration..." cp "$(dirname "$0")/help.conf" "$HELP_DOCS_DIR/workspace/help.conf" fi if [ ! -f "$HELP_DOCS_DIR/uft3changecode/index.html" ]; then echo " Creating default index.html..." cat > "$HELP_DOCS_DIR/uft3changecode/index.html" << 'EOF' UFT30ChangeCode Help

UFT30ChangeCode Help

Help Documentation Server

Path: /uft3changecode/
EOF fi echo "5. Testing configuration..." "$NGINX_BIN" -t -c "$CONF_FILE" echo "6. Starting nginx..." "$NGINX_BIN" -c "$CONF_FILE" sleep 2 echo "" echo "=== Server Status ===" if pgrep nginx > /dev/null; then SERVER_IP=$(ip addr show | grep inet | grep -v '127.0.0.1' | grep -v '::1' | head -1 | awk '{print $2}' | cut -d'/' -f1) echo "✅ Server started successfully!" echo "" echo "Access URLs:" echo " Local: http://localhost:6045/uft3changecode/" if [ -n "$SERVER_IP" ]; then echo " Remote: http://$SERVER_IP:6045/uft3changecode/" fi echo "" echo "Verify with:" echo " curl http://localhost:6045/uft3changecode/" else echo "❌ Failed to start server" echo "Check error log: /home/taoc/uft30help/workspace/logs/help_error.log" fi