How would you manage 60 Python scripts as services on Windows?

November 15, 2026 5 answers
Asked by z503!latchwork_2

I have about 60 Python scripts running continuously, mostly as event handlers. A custom launcher restarts them when they exit, but checking crashes and restarting everything after a shared code update is getting awkward.

They share a Python environment and need access to Samba shares through UNC paths. Would PM2, NSSM, Docker, or something else be a good fit on Windows?

Answers

PebbleCircuit

I'd try PM2 before building more machinery. It can run Python scripts if you configure the Python interpreter, despite being associated with the JavaScript ecosystem. Its logs give you a central place to look when a process keeps failing.

Start with a few scripts and make sure the interpreter, working directory, environment and share access are right. Then put the process definitions in configuration so restarting the group after an update is straightforward.

Javrick.3n:

Test the UNC paths under the account that actually runs the processes, not just from an interactive session. Permissions may differ.

Reply to this answer
still+in_queue

NSSM is a reasonable Windows-native route. Wrap each script as a Windows service, configure recovery and log output, and use the service controls to stop and start them for updates. Servy is another service wrapper worth comparing.

With 60 services, make their setup repeatable rather than configuring each one by hand. Also check the maintenance and packaging requirements of whichever wrapper you choose.

Rulby-5h:

For a more Python-specific option, pywin32 can be used to implement Windows services directly, though that means changing the service code rather than just wrapping the scripts.

Reply to this answer
BrambleKite

Docker feels like extra work here unless you already need containers for deployment. Share access and permissions on Windows would need careful testing, and you still need a way to monitor and restart the workloads.

If moving to Linux is actually an option, mounting the shares there and passing them into containers is another route. If Windows is fixed, I'd try a process manager or service wrapper first.

Reply to this answer
!check+the~sieve_5

It may also be worth looking at why there are 60 separate processes. If the handlers are closely related, a dispatcher with a smaller number of workers could make deployments simpler. That depends on how the events arrive and how much isolation each handler needs, so I wouldn't refactor just to avoid a service manager.

Reply to this answer
Ravlo.6n

Windows Task Scheduler is another option to evaluate for launching and managing scripts. Compare how well it handles the restart behavior and visibility you want before setting up all 60 tasks.

Reply to this answer

Add your answer

Answers are reviewed before publication.

Related Discussions