I think I got this solved. I had two errors.
- I needed '--' instead of '++' to "replace" the registry value
- I needed to escape the ampersands with '^&'. Otherwise the script tried to run jboss-cli.bat "right then and there"
"wildfly-service" update MyService --StopParams="/c \"set NOPAUSE=Y ^&^& jboss-cli.bat --controller=127.0.0.1:31415 --connect --command=:shutdown\""
The above command will update the registry. However if the service is running when you update the registry, the normal 'windows stop' commands won't work the first time. You will need to shutdown via jboss-cli.bat
jboss-cli.bat --controller=127.0.0.1:31415 --connect --command=:shutdown
After you restart the service , windows start/stop service commands will work as normal.
A few quick questions:
- Where is source code for wildfly-service.exe ?
- Can I update the "port number" portion of the Apache Procrun 2.0/<<service name>>/Parameters/Stop/Params" using 'wildfly-service.exe update' ?
Source code location?
This repo contains wildfly-service.exe executable, but not the source wildfly-service.c or wildfly-service.cc or whatnot :GitHub - wildfly/wildfly-core: The core runtime that is used by the Wildfly application server
Problem and Context
Here is our problem:
- We're running windows. That's the first problem. [ Grrr....I told them we should run Gnu/HURD! ;-)]
- We had a hole in our process/scripts that allowed "Apache Procrun" windows registry get out of sync with "standalone.xml". Specifically the "windows registry stop param" says '--localhost:9990', but standalone.xml says "--localhost:9991" (actually it says "<socket-binding name="management-http" interface="management" port="9991"/>)
So jboss listens 9991, but the windows registry thinks jboss listens on 9990.
- The result: windows service won't stop. Creates a lot of headaches. Windows "stop service" command hangs for 2 minutes..than fails..then windows says the "service is either starting or stopping"...then someone needs to run a lot of windows-mojo to kill the underlying processes, etc. ("sc queryex <<servicename>>" , etc)
- We've fixed our scripts/process on a "going forward" basis...
- but "right now" we have a bunch of jboss/wildfly windows services running that we can't stop easily.
Hoped to do this
I had hoped that we could do this
- run a script to "update the windows registry" , i.e. fix the '--localhost:<<port number>>' portion of the stop param
- stop the service normally (i.e. now that Procrun has the correct jboss mangement port)
Procrun Doc suggests I can update the service
The Apache procrun doc has this:
prunsrv //US//TestService --Description="Some Dummy Test Service" \
I thought I might be able to get away with this but it desn't seem to work.
wildfly-service update MyServiceName ++StopParams="/c \"set NOPAUSE=Y && jboss-cli.bat --controller=127.0.0.1:31415 --connect --command=:shutdown\""
where "MyServiceName" is "the service name" and "31415" is the new port.
thanks in advance