89 lines
2.7 KiB
Bash
89 lines
2.7 KiB
Bash
#!/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'
|
|
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<title>UFT30ChangeCode Help</title>
|
|
<style>
|
|
body { font-family: Arial, sans-serif; text-align: center; padding: 50px; background: #f5f5f5; }
|
|
.container { background: white; padding: 40px; border-radius: 10px; box-shadow: 0 2px 10px rgba(0,0,0,0.1); display: inline-block; }
|
|
.logo { font-size: 64px; margin-bottom: 20px; }
|
|
h1 { color: #667eea; margin: 0; }
|
|
.subtitle { color: #666; margin-top: 10px; }
|
|
.path { background: #f0f0f0; padding: 10px 20px; border-radius: 5px; margin-top: 20px; font-family: monospace; }
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="container">
|
|
<div class="logo">📖</div>
|
|
<h1>UFT30ChangeCode Help</h1>
|
|
<p class="subtitle">Help Documentation Server</p>
|
|
<div class="path">Path: /uft3changecode/</div>
|
|
</div>
|
|
</body>
|
|
</html>
|
|
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 |