-
Notifications
You must be signed in to change notification settings - Fork 4
/
tracker-web-app-start.bat
52 lines (45 loc) · 1.1 KB
/
tracker-web-app-start.bat
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
::Simple .bat script, that launchs tracker-web-app and after booting local server opens
::new page with http://localhost:8080 adress in default browser. Session log writes
::into tracker-web-app.log file.
@echo off
set "name=%date:.=%-%time::=%%~x1"
set log=tracker-web-app.log
set TCP="%temp%\TCP_ports%name:,=%.tmp"
set PIDtmp="%temp%\PID%name:,=%.tmp"
if "%1"=="" (
echo No parameters, set path to the .jar file
set /p filepath="Path: "
) else (
set filepath=%1
)
if not exist %filepath% (
echo File not found
echo File not found >>%log%
pause >nul
exit /B 1
)
echo Starting server...
start "tracker-web-app" /i /min cmd /c "get-cmd-pid.bat %PIDtmp% & java -jar %filepath% >%log% 2>&1"
timeout /T 1 /NOBREAK >nul
findstr /B "Error:" %log%
if %ERRORLEVEL%==0 (
del /F %PIDtmp%
pause > nul
exit /B 1
)
:loop
netstat -an -p TCP >%TCP%
findstr "0.0.0.0:8080" %TCP% >nul
if not %ERRORLEVEL%==0 (
timeout /T 1 /NOBREAK >nul
goto :loop
)
del /F %TCP%
start http://localhost:8080
echo Press any button to quit
set /p PID=< %PIDtmp%
pause > nul
taskkill /pid %PID% > nul
del /F %PIDtmp%
echo Server stopped
exit /B 0