xticks barplot python windows cross-platform

python - barplot - pandas plot



¿Cómo hago para que Windows sepa de un servicio que he escrito en Python? (4)

Aquí hay un código para instalar un script de python como un servicio, escrito en python :)

http://code.activestate.com/recipes/551780/

Esta publicación también podría ayudarte:

http://essiene.blogspot.com/2005/04/python-windows-services.html

En otra pregunta que publiqué ayer, recibí muy buenos consejos sobre cómo una secuencia de comandos de Python podría ejecutarse como un servicio en Windows. Lo que me pregunto es: ¿cómo sabe Windows de los servicios que se pueden gestionar en las herramientas nativas (ventana de "servicios" en "herramientas administrativas")? I. e. ¿Cuál es el equivalente de Windows de poner un script de inicio / detención en /etc/init.d bajo Linux?


Como con la mayoría de las cosas "conscientes" en Windows, la respuesta es "Registro".

Eche un vistazo a este artículo de Microsoft Knowledge Base: http://support.microsoft.com/kb/103000

Busque "Un programa Win32 que pueda iniciar el controlador de servicio y que obedezca el protocolo de control de servicio". Este es el tipo de servicio que le interesa.

El registro del servicio (contenido de KEY_LOCAL_MACHINE / SYSTEM / CurrentControlSet / Services / myservice) transporta información sobre el servicio, incluyendo cosas como su ubicación ejecutable, qué hacer cuando falla (¿detener el sistema operativo?), Qué servicios deben iniciarse antes de este , con qué usuario se ejecuta.

En cuanto al protocolo de control de servicio, se supone que main () de su programa invocará una llamada API de Windows, configurando devoluciones de llamada para iniciar, detener, pausar su servicio. Lo que haces en esas devoluciones depende de ti.


No ensucie con el registro directamente. Usuario la herramienta de línea de comandos SC. A saber, SC CREATE

DESCRIPTION: SC is a command line program used for communicating with the NT Service Controller and services. USAGE: sc [command] [service name] ... The option has the form "//ServerName" Further help on commands can be obtained by typing: "sc [command]" Commands: query-----------Queries the status for a service, or enumerates the status for types of services. queryex---------Queries the extended status for a service, or enumerates the status for types of services. start-----------Starts a service. pause-----------Sends a PAUSE control request to a service. interrogate-----Sends an INTERROGATE control request to a service. continue--------Sends a CONTINUE control request to a service. stop------------Sends a STOP request to a service. config----------Changes the configuration of a service (persistant). description-----Changes the description of a service. failure---------Changes the actions taken by a service upon failure. qc--------------Queries the configuration information for a service. qdescription----Queries the description for a service. qfailure--------Queries the actions taken by a service upon failure. delete----------Deletes a service (from the registry). create----------Creates a service. (adds it to the registry). control---------Sends a control to a service. sdshow----------Displays a service''s security descriptor. sdset-----------Sets a service''s security descriptor. GetDisplayName--Gets the DisplayName for a service. GetKeyName------Gets the ServiceKeyName for a service. EnumDepend------Enumerates Service Dependencies. The following commands don''t require a service name: sc boot------------(ok | bad) Indicates whether the last boot should be saved as the last-known-good boot configuration Lock------------Locks the Service Database QueryLock-------Queries the LockStatus for the SCManager Database EXAMPLE: sc start MyService


Puede usar srvany.exe desde el Kit de recursos de Windows NT para crear un servicio definido por el usuario que se mostrará en las herramientas de administración ...

http://support.microsoft.com/kb/137890

Estoy usando este método para ejecutar tracd (un script / servidor python) para trac.

Aquí hay algunas instrucciones muy claras: http://www.tacktech.com/display.cfm?ttid=197

Requiere una edición de registro (muy mínima y fácil), pero le permitirá convertir cualquier línea de comandos / script en un servicio de Windows.