eXist-db / exist

eXist Native XML Database and Application Platform
https://exist-db.org
GNU Lesser General Public License v2.1
428 stars 179 forks source link

How to change default windows service name? #3726

Open group131 opened 3 years ago

group131 commented 3 years ago

I have a simple (I hope) question: I installed eXist 5.2 using the jar file. I was looking for the classic "Install eXist as a service" option in Start menu and could not find it. So I started the launcher and there is an option there "Install as service". My question is: Is there a configuration file where I may change the service options?

Previous exist versions used wrapper.conf file. If I understand correctly 5.2 uses prunsrv-x86_64.exe located in bin folder.

dizzzz commented 3 years ago

There is some documentation in https://commons.apache.org/proper/commons-daemon/procrun.html

image
adamretter commented 3 years ago

At the moment this is not configurable, you would need to modify SERVICE_NAME and recompile eXist-db for yourself - https://github.com/eXist-db/exist/blob/develop/exist-core/src/main/java/org/exist/launcher/WindowsServiceManager.java#L56

group131 commented 3 years ago

OK, thought so... Thanks!

group131 commented 3 years ago

At the moment this is not configurable, you would need to modify SERVICE_NAME and recompile eXist-db for yourself - https://github.com/eXist-db/exist/blob/develop/exist-core/src/main/java/org/exist/launcher/WindowsServiceManager.java#L56

Could I ask for one more favor? Could I get the actual procrun command used to install the eXist service? What I mean is the following snippet but filled with actual values:

  final List<String> args = newList(exe.toAbsolutePath().toString(), "install", SERVICE_NAME,
                "--DisplayName=" + SERVICE_NAME,
                "--Description=eXist-db NoSQL Database Server",
                "--StdError=auto",
                "--StdOutput=auto",
                "--LogPath=\"" + existHome.resolve("logs").toAbsolutePath().toString() + "\"",
                "--LogPrefix=service",
                "--PidFile=service.pid",
                "--Startup=auto",
                "--ServiceUser=LocalSystem",  // TODO(AR) this changed from `LocalSystem` to `NT Authority\LocalService` in procrun 1.2.0, however our service won't seem to start under that account... we need to investigate!
                "--Jvm=" + findJvm().orElse("auto"),
                "--Classpath=\"" + existHome.resolve("lib").toAbsolutePath().toString().replace('\\', '/') + "/*\"",
                "--JvmMs=" + minMemory,
                "--StartMode=jvm",
                "--StartClass=org.exist.service.ExistDbDaemon",
                "--StartMethod=start",
                "--StopMode=jvm",
                "--StopClass=org.exist.service.ExistDbDaemon",
                "--StopMethod=stop",
                "--JvmOptions=\"" + jvmOptions + "\"",
                "--StartParams=\"" + configFile.toAbsolutePath().toString() + "\""
vincentml commented 2 years ago

Here is what is working for me to install more than one eXist-db instance on the same machine.

prunsrv-x86_64.exe install eXist-db-G --DisplayName=eXist-db-G --Description="eXist-db NoSQL Database Server" --StdError=auto --StdOutput=auto --LogPath="G:\eXist-db\logs" --LogPrefix=service --PidFile=service.pid --Startup=auto --ServiceUser=LocalSystem --Jvm="G:\jdk-11.0.16+8\bin\client\jvm.dll" --Classpath="G:\eXist-db\lib*" --JvmMs=1024 --JvmMx=4096 --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=G:\eXist-db\etc\log4j2.xml;-Djetty.home=G:\eXist-db;-Dexist.jetty.config=G:\eXist-db\etc\jetty\standard.enabled-jetty-configs;-Djetty.git.hash=8da83308eeca865e495e53ef315a249d63ba9332;-Dexist.home=G:\eXist-db;-Dexist.configurationFile=G:\eXist-db\etc\conf.xml" --StartParams="G:\eXist-db\etc\conf.xml"

In addition, the http and https ports need to be specified for each instance. In etc\jetty\jetty-http.xml set the value of SystemProperty "jetty.port" for http. In etc\jetty\jetty-ssl.xml set the value of SystemProperty "jetty.ssl.port" for https.