0

I've been using http://commons.apache.org/proper/commons-daemon/ to create a windows service for the Wildfly startup (using exe mode as proposed in some blogs). The problem is, that the service is immediately marked as running. I have some other services that are only allowed to start once Wildfly is up and running. Making these services depend on the Wildfly service won't work, because the startup takes between 20-60 sec.

Is there a way to make procrun wait for a return value or at least for a fixed time, before the service is marked as running?

Jens Popp
  • 131
  • 1
  • 12

1 Answers1

0

I don't use that service wrapper but the one that ships with wildfly (in the docs\contrib\scripts\service folder. (See http://www.mastertheboss.com/jboss-server/jboss-configuration/run-jboss-as-service-howto for details).

But I suspect the problem is one I see as well. wildfly starting is a quick process process - 1 or 2 seconds - but what then takes the time is deploying your ear or war files so it can actually do something useful. You can tell when that's happened by the myEar.ear.deployed file turning up. With the wildfly service wrapper, everything is done in the service.bat script, and starting the wildfly service basically means running the code at the :commandStart label.

:cmdStart
if /I "%~1"=="/name" (
if not "%~2"=="" (
  set SHORTNAME="%~2"
  )
)
%PRUNSRV% start %SHORTNAME%
echo Service %SHORTNAME% starting...
goto cmdEnd

after the echo of Service starting, you could put in a sleep for 30 s timeout /t 30 /nobreak or you could try looking for the .deployed file and looping until its there or a .failed file is there. (A simple timeout is easier!)