Monday, April 15, 2013

How to : run python script as a windows service on windows 2008

Just setup one django python application, always we run the script Python start to start a web application, if you want to run this a service. here is a quick tutorial,

Download the windows resource kit which contains one utility called svcany. basically you can run cmd as a service. most command can run on windows server 2008 all though they are designed for windows server 2003. then install it.

Here is a kb about the svcany.

then use the built in command SC to create one windows service. we just point the binPath to the scany.exe location.

SC Create Askbot80 binPath= “d:\windows resource kit\tools\svcany.exe”
#remember there must be a space between binpath= and the value.

Now when you go to services mmc, you can see the service is there.

then run regedit, to put the python script into the parameters settings.

go to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\, you can see the service we just created is there already.

we just create one new key called Parameters, and under Parameters create one string key named Application , then enter the given python and python script there.

then you can start the service we just created.

No comments:

Locations of visitors to this page