-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathSTART_BACKEND.bat
More file actions
93 lines (82 loc) · 2.31 KB
/
START_BACKEND.bat
File metadata and controls
93 lines (82 loc) · 2.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
@echo off
COLOR 0A
title ASMS Backend - Port 8080 Fix and Start
echo.
echo ========================================================
echo ASMS BACKEND - PORT 8080 FIX AND START
echo ========================================================
echo.
echo This script will:
echo 1. Find and stop any process using port 8080
echo 2. Start your Spring Boot application
echo.
echo ========================================================
echo.
REM Check if running as administrator
net session >nul 2>&1
if %errorLevel% neq 0 (
echo WARNING: Not running as administrator.
echo Some operations may fail.
echo.
echo Recommended: Right-click and "Run as administrator"
echo.
pause
)
echo [STEP 1/3] Checking port 8080...
echo.
REM Find process using port 8080
for /f "tokens=5" %%a in ('netstat -ano ^| findstr :8080 ^| findstr LISTENING') do (
set PID=%%a
goto :found
)
echo Port 8080 is free. No process to kill.
goto :start
:found
echo Found process using port 8080: PID %PID%
echo Killing process %PID%...
taskkill /F /PID %PID% >nul 2>&1
if %errorLevel% equ 0 (
echo SUCCESS! Process killed.
) else (
echo WARNING: Could not kill process. It may have already stopped.
)
timeout /t 2 /nobreak >nul
echo.
:start
echo [STEP 2/3] Verifying port 8080 is free...
netstat -ano | findstr :8080 | findstr LISTENING >nul 2>&1
if %errorLevel% equ 0 (
echo WARNING: Port 8080 is still in use!
echo Please close any applications using this port manually.
echo.
pause
exit /b 1
) else (
echo SUCCESS! Port 8080 is now free.
)
echo.
echo [STEP 3/3] Starting Spring Boot application...
echo.
echo ========================================================
echo APPLICATION STARTING
echo ========================================================
echo.
echo Backend URL: http://localhost:8080
echo Database: demo (PostgreSQL)
echo.
echo IMPORTANT: Keep this window open!
echo Closing this window will stop the application.
echo.
echo Press Ctrl+C to stop the application.
echo.
echo ========================================================
echo.
timeout /t 2 /nobreak >nul
REM Start the application
call mvnw.cmd spring-boot:run
echo.
echo ========================================================
echo APPLICATION STOPPED
echo ========================================================
echo.
pause