Skip to content

Instantly share code, notes, and snippets.

@vincentml
Last active December 12, 2022 18:57
Show Gist options
  • Save vincentml/0fede2298a7669af1aca1f31f1cdc759 to your computer and use it in GitHub Desktop.
Save vincentml/0fede2298a7669af1aca1f31f1cdc759 to your computer and use it in GitHub Desktop.
eXist-db scripts to install and run eXist-db as a service on Windows operating systems.

eXist-db scripts to install and run eXist-db as a service on Windows operating systems.

These scripts should be placed in the "bin" folder of eXsit-db, for example after downloading and unzipping exist-distribution-6.0.1-win.zip from GitHub.

prunmgr.exe //ES/eXist-db-Z
:: prunmgr.exe is not packaged with eXist and can be downloaded from https://downloads.apache.org/commons/daemon/binaries/windows/commons-daemon-1.3.2-bin-windows.zip
:: This is useful for verifying that the configuration that is specified in service-install.bat actually takes effect.
:: Install eXist-db as a Windows Service
:: This script must be run with administrator permissions
:: Update the following
:: "Z" is used as a placeholder to be replaced with the actual drive letter and instance identifier in several places
:: Also make this same replacement in service-edit.bat, service-start.bat, service-stop.bat, service-uninstall.bat
:: If more than one eXist-db instance is going to run on the same machine ensure that the service name and ports
:: are unique for each instance. Ports can be configured by specifying:
:: http port in EXIST_HOME\etc\jetty\jetty-http.xml system property jetty.port
:: https port in EXIST_HOME\etc\jetty\jetty-ssl.xml system property jetty.ssl.port
:: Set eXist location in EXIST_HOME
:: Set service name in EXIST_SERVICE_NAME
:: Set Java location
:: for Java 8 use --Jvm="Z:\jdk8u345-b01\jre\bin\server\jvm.dll"
:: for Java 11 use --Jvm="Z:\jdk-11.0.16.1+1\bin\client\jvm.dll"
:: If desired, custom system properties can be added as shown in the below example:
:: -Dmy-app-environment=production;-Dmy-app-url=http://localhost:8080/exist/apps/my-app/
:: Note: ^ is an escape character that is used to split a long command on multiple lines
set EXIST_HOME=Z:\exist
set EXIST_SERVICE_NAME=eXist-db-Z
prunsrv-x86_64.exe ^
install %EXIST_SERVICE_NAME% ^
--DisplayName=%EXIST_SERVICE_NAME% ^
--Description="eXist-db NoSQL Database Server" ^
--StdError=auto ^
--StdOutput=auto ^
--LogPath="%EXIST_HOME%\logs" ^
--LogPrefix=service ^
--PidFile=service.pid ^
--Startup=auto ^
--ServiceUser=LocalSystem ^
--Jvm="Z:\jdk-11.0.16.1+1\bin\client\jvm.dll" ^
--Classpath="%EXIST_HOME%\lib\*" ^
--JvmMs=512 ^
--JvmMx=4608 ^
--StartMode=jvm ^
--StartClass=org.exist.service.ExistDbDaemon ^
--StartMethod=start ^
--StopMode=jvm ^
--StopClass=org.exist.service.ExistDbDaemon ^
--StopMethod=stop ^
--JvmOptions=^"-Dfile.encoding=UTF-8;^
-Dlog4j.configurationFile=%EXIST_HOME%\etc\log4j2.xml;^
-Djetty.home=%EXIST_HOME%;^
-Dexist.jetty.config=%EXIST_HOME%\etc\jetty\standard.enabled-jetty-configs;^
-Djetty.git.hash=8da83308eeca865e495e53ef315a249d63ba9332;^
-Dexist.home=%EXIST_HOME%;^
-Dexist.configurationFile=%EXIST_HOME%\etc\conf.xml;^
-Dmy-app-environment=production;^
-Dmy-app-url=http://localhost:8080/exist/apps/my-app/^" ^
--StartParams="%EXIST_HOME%\etc\conf.xml"
prunsrv-x86_64.exe start eXist-db-Z
prunsrv-x86_64.exe stop eXist-db-Z
prunsrv-x86_64.exe delete eXist-db-Z
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment