Skip to content

Commit 05424f0

Browse files
authored
Merge pull request #1815 from rundeck/RUN-3585
[RUN-3585] add alternative mode to start runner as service
2 parents 7f06762 + 38323eb commit 05424f0

1 file changed

Lines changed: 42 additions & 1 deletion

File tree

docs/learning/howto/runner-service-windows.md

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,10 @@ endlocal
141141

142142
7. Execute the following command (you can copy and paste it directly on the CMD terminal to execute it):
143143

144+
:::: tabs
145+
146+
@tab Standard (`java` mode)
147+
144148
```bat
145149
runner.exe //IS//Runner ^
146150
--DisplayName=Runner ^
@@ -164,10 +168,47 @@ runner.exe //IS//Runner ^
164168
--StdError=C:\runner\runner.log
165169
```
166170

167-
:::tip Note
171+
::: tip Note
168172
The service name uses a double slash (`//IS//runner`) — this is the procrun syntax for "install service". `--Jvm=auto` lets procrun locate `jvm.dll` automatically from `JAVA_HOME` / the registry. The stop is delegated to `stop-runner.bat` through `cmd.exe`; the full path to `cmd.exe` is required because procrun passes `--StopImage` directly to `CreateProcess`, which does not search the `PATH` (a bare `cmd` fails with `The system cannot find the file specified`).
169173
:::
170174

175+
@tab Alternative (more logging, `jvm` mode)
176+
177+
With `--StartMode=java`, procrun launches the Runner as a **separate** `java.exe` process and does not pipe that process's output into `--StdOutput`/`--StdError`, so `runner.log` can stay empty. Use this `jvm`-mode variant instead: procrun loads the JVM **in-process** and captures the Runner's `System.out`/`System.err` directly into the log file.
178+
179+
```bat
180+
runner.exe //IS//Runner ^
181+
--DisplayName=Runner ^
182+
--LogLevel=Info ^
183+
--LogPath=C:\runner ^
184+
--ServiceUser=LocalSystem ^
185+
--Startup=auto ^
186+
--Jvm="<JAVA_INSTALL_PATH>\bin\server\jvm.dll" ^
187+
--StartMode=jvm ^
188+
--Classpath=C:\runner\runner.jar ^
189+
--StartClass=com.rundeck.runner.agent.RunnerApplication ^
190+
--StartMethod=main ^
191+
--StartPath=C:\runner ^
192+
--StopMode=exe ^
193+
--StopImage=C:\Windows\System32\cmd.exe ^
194+
--StopParams=/c#C:\runner\stop-runner.bat ^
195+
--StopPath=C:\runner ^
196+
--StopTimeout=30 ^
197+
--PidFile=runner.pid ^
198+
--JvmMs=1024 ^
199+
--JvmMx=4096 ^
200+
--StdOutput=C:\runner\runner.log ^
201+
--StdError=C:\runner\runner.log
202+
```
203+
204+
:::warning Set `--Jvm` to your real `jvm.dll` path
205+
In `jvm` mode, `--Jvm=auto` often fails with `no JVM configured or found in registry` (many JDK/JRE builds don't register in the Windows registry, and the `LocalSystem` account doesn't see a user-level `JAVA_HOME`). Replace `<JAVA_INSTALL_PATH>` with your Java installation directory (the same path as `JAVA_HOME`).
206+
207+
Note that `jvm` mode replaces `--StartMode=java`/`--StartParams=-jar#runner.jar` with `--StartMode=jvm`, `--Classpath` (the path to `runner.jar`) and `--StartClass` (the Runner main class). The `runner.exe` (procrun) and the `jvm.dll` must be the **same architecture** (use the 64-bit `prunsrv.exe` from `amd64\` with a 64-bit JRE/JDK).
208+
:::
209+
210+
::::
211+
171212
You will see messages similar to the following:
172213

173214
```log

0 commit comments

Comments
 (0)