Scene Restore: A project developed by python2.7, made into a Windows service, starts with the system. After the system restart, the discovery service failed to start automatically, check that the Event Viewer log Discovery service started before the MySQL database service, and the service failed to start because MySQL must be accessed in the service. Although an attempt to restart after a startup failure has been set, the project service cannot be started from startup.
Problem Detail: 1.XP system Cannot set service "auto (delay)" mode
2. The service starts before the MySQL service. Sleep is set in the code, but the service mechanism for Windows is that the system will ask the service to return the service status (whether it is already running) for a period of time since the service started (not verified, but must have been). If the program sleep is unresponsive at this time, the system will assume that the service failed to start. In fact, the program will start after the sleep, the service status has been identified as not started, so the system only provides a startup button, the service becomes the system can not control the process, can not open or shut down, only by killing process to stop the program.
Solution:
1. Open the Registry (Win+r regedit) and open the HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services path.
2. Find the services you need to set dependencies, add/modify multi-string values: DependOnService. The value is a service or program that starts before the service.
Note:
SC CONIFG Service name depend= "dependencies", this cmd command seems not very reliable, may be written incorrectly.
Setting up Windows service dependencies