Fix batch script syntax error in port check
Fixed 'was unexpected at this time' error caused by: - Unescaped parentheses in echo statements - Removed extra pipe to LISTENING filter (not needed) - Changed √ symbol to OK for better Windows compatibility - Escaped all parentheses with ^ character The port check now works correctly on Windows.
This commit is contained in:
36
setup.bat
36
setup.bat
@@ -29,59 +29,59 @@ echo Checking port availability...
|
||||
set PORTS_OK=1
|
||||
|
||||
REM Check port 8080 (Nginx)
|
||||
netstat -ano | findstr ":8080 " | findstr "LISTENING" >nul 2>&1
|
||||
netstat -ano | findstr ":8080" >nul 2>&1
|
||||
if %errorlevel% equ 0 (
|
||||
echo [X] Port 8080 (Web Server) - IN USE
|
||||
echo [X] Port 8080 ^(Web Server^) - IN USE
|
||||
set PORTS_OK=0
|
||||
) else (
|
||||
echo [√] Port 8080 (Web Server) - Available
|
||||
echo [OK] Port 8080 ^(Web Server^) - Available
|
||||
)
|
||||
|
||||
REM Check port 8025 (Mailpit Dashboard)
|
||||
netstat -ano | findstr ":8025 " | findstr "LISTENING" >nul 2>&1
|
||||
netstat -ano | findstr ":8025" >nul 2>&1
|
||||
if %errorlevel% equ 0 (
|
||||
echo [X] Port 8025 (Mailpit Dashboard) - IN USE
|
||||
echo [X] Port 8025 ^(Mailpit Dashboard^) - IN USE
|
||||
set PORTS_OK=0
|
||||
) else (
|
||||
echo [√] Port 8025 (Mailpit Dashboard) - Available
|
||||
echo [OK] Port 8025 ^(Mailpit Dashboard^) - Available
|
||||
)
|
||||
|
||||
REM Check port 1025 (Mailpit SMTP)
|
||||
netstat -ano | findstr ":1025 " | findstr "LISTENING" >nul 2>&1
|
||||
netstat -ano | findstr ":1025" >nul 2>&1
|
||||
if %errorlevel% equ 0 (
|
||||
echo [X] Port 1025 (Mailpit SMTP) - IN USE
|
||||
echo [X] Port 1025 ^(Mailpit SMTP^) - IN USE
|
||||
set PORTS_OK=0
|
||||
) else (
|
||||
echo [√] Port 1025 (Mailpit SMTP) - Available
|
||||
echo [OK] Port 1025 ^(Mailpit SMTP^) - Available
|
||||
)
|
||||
|
||||
REM Check port 6379 (Redis)
|
||||
netstat -ano | findstr ":6379 " | findstr "LISTENING" >nul 2>&1
|
||||
netstat -ano | findstr ":6379" >nul 2>&1
|
||||
if %errorlevel% equ 0 (
|
||||
echo [X] Port 6379 (Redis) - IN USE
|
||||
echo [X] Port 6379 ^(Redis^) - IN USE
|
||||
set PORTS_OK=0
|
||||
) else (
|
||||
echo [√] Port 6379 (Redis) - Available
|
||||
echo [OK] Port 6379 ^(Redis^) - Available
|
||||
)
|
||||
|
||||
REM Check database port based on selection
|
||||
if "%DB%"=="mysql" (
|
||||
netstat -ano | findstr ":3306 " | findstr "LISTENING" >nul 2>&1
|
||||
netstat -ano | findstr ":3306" >nul 2>&1
|
||||
if !errorlevel! equ 0 (
|
||||
echo [X] Port 3306 (MySQL) - IN USE
|
||||
echo [X] Port 3306 ^(MySQL^) - IN USE
|
||||
set PORTS_OK=0
|
||||
) else (
|
||||
echo [√] Port 3306 (MySQL) - Available
|
||||
echo [OK] Port 3306 ^(MySQL^) - Available
|
||||
)
|
||||
)
|
||||
|
||||
if "%DB%"=="pgsql" (
|
||||
netstat -ano | findstr ":5432 " | findstr "LISTENING" >nul 2>&1
|
||||
netstat -ano | findstr ":5432" >nul 2>&1
|
||||
if !errorlevel! equ 0 (
|
||||
echo [X] Port 5432 (PostgreSQL) - IN USE
|
||||
echo [X] Port 5432 ^(PostgreSQL^) - IN USE
|
||||
set PORTS_OK=0
|
||||
) else (
|
||||
echo [√] Port 5432 (PostgreSQL) - Available
|
||||
echo [OK] Port 5432 ^(PostgreSQL^) - Available
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user