You can control the order of service startup and shutdown with thedepends_on option. Compose always starts and stopscontainers in dependency order, where dependencies are determined bydepends_on, links, volumes_from, and network_mode: "service:...".
If I start the service manually, and after I do shutdown, everything is ok when I turn on again the PC. So the services are automatically started as should be. The problem appear only if I restart Windows. After restart, these services are not started automatically.
How to identify Windows Services delaying Shutdown or Startup
The only solution that works for the moment is to change the startup type of these services from Automatic to Automatic Delayed.I don't know if this is the best solution , but is the only that works for now.
I had the same problem. The services did not restart automatically after the machine was restarted.The reason is that the Windows 10 shutdown button does not mean (unlike Windows 7) a shutdown but can be considered as a standby if the "Set Power Buttons" configuration is as this.
Starting with Windows 8.x, the default shutdown and restart scenario has been updated and named fast startup. Fast startup begins with the shutdown process and includes writing data to disk similar to the hibernate process. A key difference is that all user sessions (Session 1) are logged off and the remaining information is written to the hiberfile. When you boot the PC from this state, Windows loads the previously initialized state by reading from the hiberfile, instead of running the full boot process in which Windows, drivers, devices, and services are initialized. This method speeds up the process of initializing the lock or Start screen.
The faster startup and shutdown sequence uses the hibernate infrastructure to place the PC in hibernate. Unlike a full shutdown and boot, the user session is closed and a hibernate is performed. As a result, the hibernate file is much smaller, ensuring that the hibernate and resume process is faster. This sequence also takes advantage of the parallelization optimizations.
Developers creating drivers or apps with a system service and system integrators should monitor driver quality issues, such as memory leaks. Although driver quality has always been important, note that the up-time between kernel reboots might be significantly longer than on previous versions of Windows because during user-initiated shutdowns, the kernel, drivers, and services are preserved and restored, not just restarted.
To ensure the best compatibility with apps while enabling the best possible experience for new apps, new flags to request a shutdown for fast startup have been created. The following table describes the new flags and the behavior of the shutdown APIs. Details on these APIs and flags are available on MSDN.
Device drivers will receive a notification to transition to an S5 target power state on shutdown rather than a hibernate state of S4, which is the actual power state. This allows the drivers to set a different wake behavior for fast startup after a shutdown. Target and effective states are found in the System_Power_State_Context structure.
More than one way to start WindowsThe first step in rooting out the cause of interminable boots is using the System Configuration utility's "Diagnostic startup" option. Press the Windows key (in XP, the Windows key plus R), type msconfig, and press Enter. Under the General tab, select "Diagnostic startup" and click OK. When you restart Windows, only basic services and devices will be available. With this option selected, Windows should start in just seconds.
System Configuration's "Selective startup" option lets you exclude system services and/or start-up items when Windows loads. Microsoft provides more information on these and Vista's other System Configuration options in a Help and How-to article, Using System Configuration. Similar information for XP is available in Microsoft's "System Configuration Utility overview."
I know I'm bringing this up from the dead but I found it helpful and hope to add a little to the topic. I'm implementing a WCF duplex library hosted in a Windows Service and came across this thread because I needed to detect, from within the windows service, when a user logs off or shuts down the computer. I'm using .Net Framework 4.6.1 on Windows 7 and Windows 10. Like previously suggested for shutdown what worked for me was overriding ServiceBase.OnShutdown() like so:
If you set up both an Administration Server and a Managed Server to run as Windows services on the same computer, modify the WebLogic Server master script so that the Managed Server starts only after the Administration Server finishes its startup cycle. For more information, refer to Requiring Managed Servers to Start After Administration Servers.
Sometimes, applications are temporarily unable to serve traffic.For example, an application might need to load large data or configurationfiles during startup, or depend on external services after startup.In such cases, you don't want to kill the application,but you don't want to send it requests either. Kubernetes providesreadiness probes to detect and mitigate these situations. A pod with containersreporting that they are not ready does not receive traffic through KubernetesServices.
Have you ever seen that your computer starts booting slowly? Or it slowly restores its state from hibernation. Maybe you observe performance issues when shutdown or hibernate process? In this article, I will show you how you can use Event Log Explorer to find performance problems linked with the startup/shutdown/hibernate/resume processes.
I believe this is due to a windows update, all of the users services were starting automatically and recently they have stopped auto starting. As time goes on and more people update, more and more services may stop automatically starting this could be a big problem.
Services feature a very basic interface, but within it are hundreds of services, most bundled with Windows 10 and others added by third parties. At the top are menus for customizing the view of your services and changing their startup behavior. By default, we are in detail view, which displays columns with the description, running status, startup type and Log On As.
Some services are set to manual while others are automatic. Automatic services are those that startup with Windows 10, while those that are manual are only triggered on demand by a program or device. If there is a service you think you need to have started with Windows, you can change it by right-clicking the service, then clicking Properties.
If the boot time improves in the clean boot environment, look for startup apps that are bogging down your computer. To identify the problematic app, enable all the services and turn off the clean boot in System Configuration. Restart your PC and make a note of all the apps that run at startup. Disable each program one by one to identify and delete the malfunctioning app.
You can also set the service startup type via the registry via PowerShell. All Windows services are stored in the HKLM\System\CurrentControlSet\Services registry key. Each service child key has a REG_DWORD value called Start that represents the startup type (excluding delayed start).
Windows can take longer than usual to shut down when services, background processes, drivers or applications prevent it from shutting down normally. Diagnose and solve a shutdown issue by viewing running processes in Task Manager, clean-booting your laptop or starting Windows in safe mode.
If your laptop shuts down normally with all services and startup items disabled, one of these processes is preventing Windows from shutting down normally. To determine which one it is, experiment by enabling several startup items or services until the problem returns, then systematically narrow down the enabled processes until you find the one causing a problem.
windows_service 'name' do binary_path_name String delayed_start true, false # default value: false dependencies String, Array description String desired_access Integer # default value: 983551 display_name String error_control Integer # default value: 1 load_order_group String pattern String reload_command String, false restart_command String, false run_as_password String run_as_user String # default value: "localsystem" service_name String # default value: 'name' unless specified service_type Integer # default value: 16 start_command String, false startup_type Symbol # default value: :automatic status_command String, false stop_command String, false supports Hash # default value: "restart"=>nil, "reload"=>nil, "status"=>nil timeout Integer # default value: 60 action Symbol # defaults to :nothing if not specifiedend
In this second entry, I'll address the separate but related problem, particularly if you're running CF as a Windows service, that you may find you get timeout errors from the Windows Services panel itself. I'll share some tips to help with that, which I share often with clients of my independent consulting as a CF troubleshooter. The first thing to understand is that there is indeed a timeout (configurable) for how long the Windows Services control panel is willing to wait. Beyond that, though, there are some 3 more tricks you can use to avoid that timeout. (And I would say again that sometimes you really want to focus instead on WHY CF is taking so long to startup or shutdown, but until you do, the following info may help give you some breathing room.) Update: I should add that a commenter suggested that another solution was just to kill the task. Um, yeah. I knew that, of course. :-) But the point of this entry, like the last one, is when you DON'T just want to kill it. In particular, I made the point in the last entry that if you want to find out *why* CF is taking so long to shutdown, then you need to let it run to completion to see if it may log some diagnostics. See the last entry for more on that. But yes, as Russ Michaels noted, sure, you can also just kill the task. I will say I try to avoid doing that whenever possible, to let CF end gracefully, unless I'm forced to kill it for urgency sake. Note that these tips can be helpful for everyone who runs CF as a Windows service, and indeed for anyone running any application as a Windows service. Tip 1: There is a timeout set for how long the Windows Services panel will wait So the first thing to note is that, yes, the Windows Services control panel has a fixed duration for how long it's willing to wait for an action (start, stop, or restart) to take, which is configurable in the registry. If the service control action you request does not finish in time, you'll get an error like "The service did not respond to the start or control request in a timely fashion", with associated event log errors like 1053, 7000, 7009, 7011, and so on. And technically, you should be able to control that timeout via a registry key, called ServicesPipeTimeout, which is discussed in this Microsoft technote and defined in HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control. Sadly, though I've tried it on multiple machines, I'm not finding it to work. The technote shows clearly how to either update or add it (if it doesn't exist), including noting that you need to choose the "decimal" option to see the value, which is in milliseconds. The technote does note that you must restart Windows for that change to take effect (and I have done that, and double-checked the value, keyname, and location.) If anyone has more thoughts on this, why it may not be working for me, feel free to share. Still, you will find many blog entries and discussions proposing this, for CF and other servers, so maybe it will work for you. The technote doesn't clarify what the default is if the key is not there at all, though I've found some mention that it's 30 seconds. I suppose it could vary by version of Windows (anyone know for sure?). (Note that there is another key you may see (or hear about) set in the same location: WaitToKillServiceTimeout. That is NOT related to this discussion. That key, instead, controls how long Windows should wait for any/all services to stop when you shutdown Windows itself, which is interesting to consider for itself, but not related to this particular blog entry about Services control panel timeouts.) Of course, all the usual warnings apply about messing with the registry. But it's the solution, if you need it. So again, this ServicesPipeTimeout registry key would seem to be the one that controls how long the Services panel is willing to wait for a requested action to finish. Do beware that it's system-wide setting, controlling all services. What may be good for you (CF) may not be good for all services, so be careful. Second, again, note that the server will require a restart for that to take effect. Whether it works for you or not, the remaining tips should be helpful. For instance, if you can't change that registry settings, or don't want to, or you find some day the Services panel is still taking too long to stop a service and you worry it may timeout (the control panel), then there are 3 more tips I often share with my customers (and now you, dear readers). Tip 2: Use stop/start, instead of restart Again, if you're being plagued by a service start or stop taking a long time, here's something you may not have considered. Most often when people want to restart CF (or some other service) they will use the "restart" action in the Services panel. That's logical, of course. But consider that when you have a problem with the action taking too long (stop and/or start, since a restart does both), both have to finish in that configured timeout time (above). You can help matters by doing not a restart but a stop and start separately. That way, each action can take whatever the max time is that's configured (per above) to do just the one action. Sure, it's a little painful. You do have to wait for (and notice) the stop before then doing the start. There's also the risk that even the stop may take too long. I'll offer two more tips related to that. Tip 3: Close the progress bar before its "times out" This one may not be as obvious, but it does really help. When you have a start/stop/restart action (for the Windows Services control panel) taking a long time, you risk hitting that timeout above. But notice that Services panel shows a progress bar indicating the duration of the action you've requested. Here's the tip: if/when it's about to reach the end of its indicated time, note that you can hit the "close" button. That will prevent it complaining about not being able to stop the service. (And BTW, I've seen situations where hitting that timeout limit not only gives an error but even causes the start/stop/restart buttons to be disabled, requiring a restart of the box!) Once you close the progress bar, you can use the refresh button in the Services panel (or f5) to watch for when the service goes from "stopping" to blank, meaning it's down. Same for when you "close" it while starting a service: it will go from "starting" to "started". Just be aware: If you were doing a "restart" (versus a stop or start), and you hit the close button while the service (CF) is still stopping, note that when it does finally "stop", your having "closed" the window will in fact keep the "start" step of the restart from happening. You need to manually click the "start" button to get it to proceed. Tip 4: Consider not using the Services Panel at all Still another tip (which I use regularly) is that you don't actually HAVE to use the Windows services panel to stop/start Windows services. You can do it from the command line (or a shortcut or batch file). To be clear, I'm not talking about starting the program itself from the command line (CF, as I've been discussing in these last 2 entries), but the Windows service that starts the program. It's a subtle difference. As an alternative to starting the Windows Service (for CF) using the Service control panel (Control Panel>Administrative Tools>Services, to be clear), you can use a command line command like this, which I use to stop CF: net stop "ColdFusion 9 Application Server" The service name is whatever is shown in the properties for the service you want to stop. (And of course you would use a "start" command instead to start the service. There is no "restart" command, buy you could create a batch file to do both.) You can run this from the command line (Start>Run>cmd) or as a batch file, but I prefer instead to just setup a Windows shortcut, which you can do by right-clicking the desktop and choosing new>shortcut. That will prompt you for the command (it just asks you to "type the location of the item", but just enter that command above). It will then ask for a name for the shortcut. I call mine simply "stop cf9". And while you can then execute it by going to the desktop and double-clicking it, a niftier tip is that with more modern Windows versions (2008, 7, Vista), when you hit the the Window Start menu, it now offers a search feature, and you should be able to type "stop cf9" (or just type "stop " and leave it to pop any shortcuts you've created this way to stop various services.) So why do I like this approach, of stop/starting the service from the command line instead? Because what happens is that a window pops opens (the traditional black background for DOS windows, so easy to observe) and it shows the stop (or start) taking place, however long it takes (which may be very fast). The key benefit is that the window will close on its own when the action is done (however long it takes). I just watch for the stop to be done, and then I do the start. There is a possibility, of course, that there will be an error in the shortcut or batch file (or perhaps as a response to the correct command), in which case the window will close leaving no chance to see the error. In that case, I just go to the command line (Start>Run>cmd) and execute the same net stop or start command to see what the error is. To be clear, using this command-line doesn't stop you or others from using the Services panel. Conclusion All that said, though, again, if the reason you need to worry about all this is that your CF Service is taking a long time to stop, and you want to find out why, then I would point you again to the last entry I did, In my last entry, CF911: Is your ColdFusion service taking too long to shut down? Find out why. Hope all that was helpful, whether you use CF or not. Please do let me know in the comments below. For more content like this from Charlie Arehart:Signup to get his blog posts by email:
Follow his blog RSS feed
View the rest of his blog posts
View his blog posts on the Adobe CF portal
Need more help with problems?If you may prefer direct help, rather than digging around here/elsewhere or via comments, he can help via his online consulting services
See that page for more on how he can help a) over the web, safely and securely, b) usually very quickly, c) teaching you along the way, and d) with satisfaction guaranteed
Comments (13) Related Blog Entries 2ff7e9595c
Comments