Is it possible to increase the time when calling stop or restart on a generated linux/unix service launcher, before the call fails saying that the call timed-out? I found that on windows you have to edit the registry since its implemented as a Windows Service, but couldn't find any information on changing the timeout on linux/unix.
By default, the timeout is 120 seconds. For Linux/Unix service launchers, you can set the VM parameter
-Dinstall4j.daemonTimeout=600
to increase it to 600 seconds.
Related
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?
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!)
My requirement is to restart the windows vm after the software gets installed, I am automating the entire process using chef. Is there any method for doing that?
Can we do through power shell ?
Is there any method for chef to that ?
The windows cookbook offers a reboot resource.
As mentioned above check out the links windows cookbook & windows reboot. All my info is gathered from the previous links.
Include the WindowsRebootHandler in the recipe
include_recipe 'windows::reboot_handler'
Create a reboot block
windows_reboot 30 do
timeout 30
reason 'Restarting computer in 30 seconds!'
action :nothing
end
timeout: timeout delay in seconds before rebooting. default is 60 seconds
reason: reason for the reboot. default is 'Opscode Chef initiated reboot'
Notify the reboot block to trigger the reboot
notifies :request, 'windows_reboot[30]', :delayed
:delayed - notification is queued up and executed at the very end of a chef-client run
:immediately - notification is ran immediately
I have a critical windows service that I need for my web application.
Unfortunately, the windows service does not start properly, but remains in a status of "Starting" for about 7 minutes and 38 seconds, and then fails.
My web application works fine when the service is in the "Starting" mode.
I have a windows scheduled task that runs every minute to restart the service if necessary.
net start "my service"
Therefore there is a gap of about 22 seconds from when the service fails until it starts up again. In additional it takes an additional 30 seconds or so for my application (which is dependent on this service) to start working.
I have intentionally not named the errant service. I did open a separate question https://stackoverflow.com/questions/8470975/oracle-oc4j-service-keeps-stopping whose aim was to actually solve the problem.
In this question, I am not trying to solve the problem, but rather find a workaround to try and keep this service in a status of "Starting" the whole time.
What is infuriating, is that until I restarted the server today, my workaround of restarting the service every 3 minutes actually worked, with no application downtime whatsoever.
Does anybody have any suggestions? I did try changing the registry key of ServicesPipeTimeout to 86400000 (24 hours!) in a bid to keep the service in the status of "Starting" for longer.
I have found a possible solution to my problem that I am very uneasy about...
I downloaded WinDbg from http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=8279
I opened WinDbg and did Attach to Process, and selected my service.
As long as WinDbg is open, it seems to "hold" the process and prevent it from stopping.
How long it will continue to do so, remains to be seen, but it has held for over half an hour now (whereas before the service stopped after 8 minutes)
If you have the timeout set to 24 hours and the service does not start or stay in 'starting' mode , then it must be either crashing or closing itself down.
If you want to try to restarting your service immediately it crashes, then, on the properties of your service, select the 'Recovery' tab. You should be able to set the service to restart on first, second and subsequent failures and set the service to restart after 0 minutes,
Note, this will not work if windows thinks that the service is closing down properly.
It should go without saying that this is a last resort only if you can't get whoever wrote the service to fix the problems.
Try specifying 'Restart the Service' for all three sections on the Recovery tab, but that will only work if the service is ending abnormally.
Our company faced a similar problem and we developed Service Protector, a commercial application that can babysit a service and keep it running 24/7. It may work in your situation too.
I am running the Tomcat that gets delivered with your Eclipse download (no, I don't want to download and install the entire Tomcat), and sometimes it hangs when stopping or restarting, and the only way I can find to make it work is restarting all my Eclipse. I am using it under Windows.
Is there any way to kill the Tomcat process (which doesn't appear in the Task Manager)?
It appears as javaw.exe in task manager. An alternative is to execute Tomcat/bin/shutdown.bat.
As to the hang problem, are you sure that your webapp isn't spawning unmanaged threads which might be blocking Tomcat's shutdown?
On Windows, if you know the port Tomcat listens to (below, it is 8080), you can find the PID of the Tomcat process and then kill it from cmd:
> netstat -aon | find "8080"
TCP 0.0.0.0:8080 0.0.0.0:0 LISTENING 2196
TCP [::]:8080 [::]:0 LISTENING 2196
> taskkill /pid 2196 /f
SUCCESS: The process with PID 2196 has been terminated.
I use better way to shutdown tomcat when it is not found in task manager.
1) Download TCPView(only 285kb) from following link.
http://technet.microsoft.com/en-in/sysinternals/bb897437.aspx
2) Extract folder and start TCPView application.
3) Right click on java.exe and select End Process option.
this would stop your tomcat easily.. This tool is very useful in monitoring port usage.
NOTE: Running TOMCATPATH/bin/shutdown.bat may not shutdown Tomcat when it contains some demon or unmanaged
threads. In such cases TCPView works fine without any issues.
You can set a timeout on startup and shutdown for your Tomcat server in Eclipse. If these timeouts are exceeded, Eclipse will pop up a message asking you if you want to kill it, or keep waiting.
To set these, double-click the name of the server in your Servers tab. It'll open a window like this:
There's a Timeouts section on the right hand side. I set startup to a day (so I can debug startup without it timing out), and shutdown to 30 seconds to be generous (usually this can be very short, since most apps can survive a forced shutdown with no issues).
If you use Linux, try the following steps.
List Tomcat processes (e.g., ps aux | grep catalina)
Locate the strings that look like this: myname 2244 5.5 0.3 57020937 2110741 ? Sl Oct03 5160:01 /usr/lib/jvm/java-1.8.0-<...>/bin/java <...> org.apache.catalina.startup.Bootstrap start
Copy-paste everything between /usr/lib/jvm/<...> and <...>.Bootstrap
Add stop at the end of your command and run it
Essentially, you would take the very same command that was used by Eclipse to start Tomcat and modify the last argument to stop Tomcat.
I run a Powershell script on a computer that has no Internet connection. But it takes about 30 seconds to start it. How do I solve it?
I have run ngen.
There is a known issue with certificate revocation list checks and .NET (which PowerShell is built on). Check out this post about the .NET issue.
Sounds like it might be trying to do a DNS lookup, and waits for it to time-out. I presume it doesn't take ~30 seconds to start on a machine with internet connection? You could try setting a bogus DNS resolver on the working machine, and see if it takes ~30 seconds there too.