forked from conductor-oss/conductor
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconductor_server.bat
More file actions
86 lines (70 loc) · 2.58 KB
/
conductor_server.bat
File metadata and controls
86 lines (70 loc) · 2.58 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
@echo off
REM Conductor Server Startup Script for Windows Command Prompt
REM Downloads the server JAR if missing and starts it with java
REM
REM Usage:
REM Interactive: conductor_server.bat
REM With args: conductor_server.bat [PORT] [VERSION]
REM conductor_server.bat 9090 3.22.0
REM Check for Java and version 21+
java -version >nul 2>&1
if errorlevel 1 (
echo Error: Java is not installed or not in PATH
exit /b 1
)
set JAVA_VER=
set JAVA_MAJOR=
for /f "tokens=3" %%i in ('java -version 2^>^&1 ^| findstr /i "version"') do set JAVA_VER=%%i
set JAVA_VER=%JAVA_VER:"=%
for /f "tokens=1 delims=." %%a in ("%JAVA_VER%") do set JAVA_MAJOR=%%a
if not defined JAVA_MAJOR (
echo Error: Unable to determine Java version
exit /b 1
)
if %JAVA_MAJOR% LSS 21 (
echo Error: JDK 21 or higher is required. Current version: %JAVA_VER%
exit /b 1
)
set REPO_URL=https://conductor-server.s3.us-east-2.amazonaws.com
REM Defaults
set SERVER_PORT=8080
set CONDUCTOR_VERSION=latest
REM Argument parsing
REM %1 could be port or version (if simple detection needed, but batch is hard)
REM Sticking to positional: %1=PORT, %2=VERSION
REM If %1 is provided, assume it is PORT unless it contains dots or chars?
REM For simplicity in batch, let's keep strict: %1=PORT, %2=VERSION
REM To use default port and custom version: conductor_server.bat default 3.22.0
if not "%~1"=="" (
if not "%~1"=="default" set SERVER_PORT=%~1
) else if not "%CONDUCTOR_PORT%"=="" (
set SERVER_PORT=%CONDUCTOR_PORT%
)
if not "%~2"=="" (
set CONDUCTOR_VERSION=%~2
)
REM Interactive prompts if no args
if "%~1"=="" if "%CONDUCTOR_PORT%"=="" (
set /p INPUT_PORT="Enter the port for Server [8080]: "
if not "%INPUT_PORT%"=="" set SERVER_PORT=%INPUT_PORT%
set /p INPUT_VERSION="Enter the version [latest]: "
if not "%INPUT_VERSION%"=="" set CONDUCTOR_VERSION=%INPUT_VERSION%
)
set JAR_NAME=conductor-server-%CONDUCTOR_VERSION%.jar
set JAR_URL=%REPO_URL%/%JAR_NAME%
REM Use CONDUCTOR_HOME if set, otherwise use current directory
if "%CONDUCTOR_HOME%"=="" set CONDUCTOR_HOME=.
set JAR_PATH=%CONDUCTOR_HOME%\%JAR_NAME%
REM Download JAR if not present
if not exist "%JAR_PATH%" (
echo Downloading Conductor Server %CONDUCTOR_VERSION%...
if not exist "%CONDUCTOR_HOME%" mkdir "%CONDUCTOR_HOME%"
curl -L -o "%JAR_PATH%" "%JAR_URL%"
if errorlevel 1 (
echo Failed to download Conductor Server JAR
exit /b 1
)
echo Downloaded to %JAR_PATH%
)
echo Starting Conductor Server %CONDUCTOR_VERSION% on port %SERVER_PORT%...
java -jar "%JAR_PATH%" --server.port=%SERVER_PORT%