How do you install a service on MSW?

F

Frank Millman

Hi all

This is not strictly a Python question, but I hope it is not too far
off topic.

The question is 'How do you install a service on MSW?' Here is the
background.

The accounting application I am writing is multi-user. To handle
logins, record locking, etc, I have written a simple socket server
program to keep track of various activities, which must run in the
background all the time. It is written in Python and uses
socket.socket(). It works well.

I need it to work on both Linux and MSW. Up to now I have opened a
separate terminal window, and run it from there. This works fine on
both platforms. Now I want it to run as a true background service.

I have figured out how to do this in Linux. On MSW I naively expected
to be able to go to Control Panel > Adminstrative Tools > Services,
right click, and find an option to add a new service. No such luck.
Can anybody please explain how I might be able to do this, or at least
tell me where I can read up on it.

I am using Python 2.3.3 with Win32 extensions on Windows 2000 Pro.

Thanks in advance

Frank Millman
 
B

Benjamin Niemann

"Real" Windows services have to provide certain functions. But there is
a tool called SrvAny.exe that can run any program as a service. It's
part of the Microsoft Resource Kit. Not really easy to use (I tried to
use it once, but failed...). Ask Google or MSDN.
 
D

Duncan Booth

(e-mail address removed) (Frank Millman) wrote in
I have figured out how to do this in Linux. On MSW I naively expected
to be able to go to Control Panel > Adminstrative Tools > Services,
right click, and find an option to add a new service. No such luck.
Can anybody please explain how I might be able to do this, or at least
tell me where I can read up on it.

I am using Python 2.3.3 with Win32 extensions on Windows 2000 Pro.

Try reading Python Programming on Win32 by Mark Hammond & Andy Robinson,
chapter 18 is all about services. Alternatively Google for win32serviceutil
which is the module you need to know about.
 
E

Elbert Lev

Duncan Booth said:
(e-mail address removed) (Frank Millman) wrote in


Try reading Python Programming on Win32 by Mark Hammond & Andy Robinson,
chapter 18 is all about services. Alternatively Google for win32serviceutil
which is the module you need to know about.

Download and install pywin32-201.win32-py2.3.exe.

In examples there is want: service.

Good luck
 
F

Frank Millman

Hi all

This is not strictly a Python question, but I hope it is not too far
off topic.

The question is 'How do you install a service on MSW?' Here is the
background.

Thanks so much for the replies - very useful.

I do not want to go to the effort of creating a full Windows service,
so I looked for srvany.exe, as suggested by Benjamin. This allows you
to run any program as a service. I installed it, and it seems to work.
I have only tried it on my personal machine so far, so I have not put
it under any stress, but it looks as if it will do the job. I will be
happy to provide details if anyone is interested.

Thanks again

Frank
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,202
Messages
2,571,057
Members
47,661
Latest member
sxarexu

Latest Threads

Top