Running the agent as a windows service
Overview
You can run the RapidDeploy agent as a Windows service using the procedure detailed below.
Environment Variables to set
These variables are optional and do not normally require setting unless you plan to install the agent separate to the Windows service files:
MV_AGENT_HOME: The agent home directory, containing agent files. This is the folder under which there are bin, lib, win-service directories MV_AGENT_BASE: The agent base directory, containing MidVision windows service bat and exe files (prunsrv.exe) CMD_LINE_ARGS: The agent command line arguments, e.g. "definition=%MV_AGENT_HOME%\bin\midvision-remoting-agent-server.xml;name=midvision-remoting-server" CLASSPATH: Classpath, including the agent orchestration jar file MV_AGENT_DEFINITION_FILE: The agent definition xml file, normally "midvision-remoting-agent-server.xml" MV_AGENT_CLASS: The main class that starts the agent java process. EXECUTABLE: The agent executable, e.g. "%MV_AGENT_HOME%\win-service\prunsrv.exe" JRE_HOME (or JAVA_HOME if jdk is installed) The path to the JDK or JRE on the agent server. By default the shipped one is used. JVM: The Java VM dll, e.g. "%MV_AGENT_HOME%\jre\bin\server\jvm.dll"
Install service
- Go to your %MV_AGENT_HOME%\win-service directory.
- Run, from the %MV_AGENT_HOME% folder (to install):
mv_agent_service.bat install
Remove service
Run (to remove service):
mv_agent_service.bat remove
Print service
Run (to print service details):
mv_agent_service.bat print
Start/Stop agent service
Start:
mv_agent_service.bat start
or ------------------------------------------------------------------- net start "MidVisionAgent" -------------------------------------------------------------------
Stop:
mv_agent_service.bat stop
or ------------------------------------------------------------------- net stop "MidVisionAgent" -------------------------------------------------------------------
The stop may time out (but the service will be stopped).
Windows 32 and 64 bit platforms
There are two versions of prunsrv.exe shipped in the agent. These are:
- prunsrv.exe (64 bit)
- prunsrv32.exe (32 bit)
If you are running on a 32 bit windows platform, with a 32 bit JRE, you must use the prunsrv32.exe. In order to use this file, back up the prunsrv.exe file and then rename prunsrv32.exe to prunsrv.exe. In all other cases, please use the shipped prunsrv.exe.
You can check the version of JRE you are using as follows:
c:\>%MV_AGENT_HOME%\jre\bin\java -version java version "1.8.0_101" Java(TM) SE Runtime Environment (build 1.8.0_101-b13) Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode) c:\>
The above indicates a 64-Bit JRE.
Also you can check which version of prunsrv.exe just running:
c:\>%MV_AGENT_HOME%\win-service\prunsrv.exe version