alexsilva / supervisor

Supervisor process control system for Windows
http://supervisord.org
Other
118 stars 26 forks source link

service on windows can not be started #38

Closed callmejobshen closed 3 years ago

callmejobshen commented 3 years ago

Hi Alex,

I installed supervisor-win 4.6.0 on windows 10 enterprise @2019.

then i ran following commands in a "Elevated" dos command window

echo_supervisord_conf.exe > supervisord.conf more supervisord.conf python -m supervisor.services install -c supervisord.conf

I got following output

Installing service Supervisor Pyv3.9 Changing service configuration Service updated

And i could see the service was added to windows service.

Then i ran C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Administrative Tools\services.msc Elevated, so that i can have the permission to start the service.

But when i click the start, i received following error message immediately

Windows could not start the Supervisor Pyv3.9 process monitor service on Local Computer Error 1053: The service did not respond to the start or control request in a timely fashion.

I wonder what could be wrong, and if i can not use it as windows service, can i use something like "supervisiorctl start" to manually start the programs, assume i add my programs to the program section?

thanks, Job

callmejobshen commented 3 years ago

supervisor-win-fail

alexsilva commented 3 years ago

The path to the supervisor.conf file must be absolute. python -m supervisor.services install -c c:\supervisord.conf or d:\supervisord.conf

Otherwise the execution failure will be in a log file in the python directory.

callmejobshen commented 3 years ago

Thank you Alex.

I removed and reinstalled the service with the absolute path, still got the same error. See screen shot.

Where can i find the log file? The Scripts or Lib\site-packages\supervisor has no log file.

supervisor-win-fail2

alexsilva commented 3 years ago

The log in your case is in the c:\test directory.

I noticed that your setup has a virtual environment and may be causing the issue.

callmejobshen commented 3 years ago

I repeated it without virtual environment, and got a different error.

I don't know what file it was trying to access, and maybe because the service could not started, there is no log file under c:\test.

supervisor-win-fail3

alexsilva commented 3 years ago

This error is difficult to solve because the service is failing before generating the log file. What you can do is try to run the supervisor on the terminal

If the command below runs without fail, it means that the problem is with the windows service script (supervisor.services) python -m supervisor.supervisord -c c:\test\supervisord.conf

The only solution in this case is to use a debugger tool to find the fault location. https://tamentis.com/projects/rpdb/ https://github.com/tamentis/rpdb https://docs.python.org/3/library/pdb.html

You would have to install the package and import it at the beginning of the script supervisor.services. import rpdb; rpdb.set_trace()

alexsilva commented 3 years ago

I was also seeing similar errors and just run

python -m supervisor.services

and the service initialization worked. Sometimes the windows apis behave strangely.

alexsilva commented 3 years ago

I made some changes that might solve your problem. Need to test.

https://github.com/alexsilva/supervisor/commits/windows

python -m pip install git+https://github.com/alexsilva/supervisor@windows -U