-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_server.bat
More file actions
58 lines (50 loc) · 1.21 KB
/
run_server.bat
File metadata and controls
58 lines (50 loc) · 1.21 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
@echo off
REM ANPR Server Wrapper Script
REM This script runs the ANPR API server and handles restart requests.
REM When the server exits and a .restart_flag file exists, it restarts.
setlocal enabledelayedexpansion
set "RESTART_FLAG=.restart_flag"
set "HOST=localhost"
set "PORT=8000"
REM Parse command line arguments
:parse_args
if "%~1"=="" goto :start_loop
if /i "%~1"=="--host" (
set "HOST=%~2"
shift
shift
goto :parse_args
)
if /i "%~1"=="--port" (
set "PORT=%~2"
shift
shift
goto :parse_args
)
shift
goto :parse_args
:start_loop
echo.
echo ========================================
echo ANPR Server Starting...
echo Host: %HOST%
echo Port: %PORT%
echo ========================================
echo.
REM Delete any existing restart flag
if exist "%RESTART_FLAG%" del "%RESTART_FLAG%"
REM Run the server
python src/main.py --mode api --host %HOST% --port %PORT%
REM Check if restart was requested
if exist "%RESTART_FLAG%" (
echo.
echo ========================================
echo Restart requested. Restarting server...
echo ========================================
del "%RESTART_FLAG%"
timeout /t 2 /nobreak >nul
goto :start_loop
)
echo.
echo Server stopped.
pause