Search code examples
pythonpython-3.xservicebackend

How do I keep my python backend scripts running forever on Microsoft Windows?


I want to keep my Python scripts running forever on Windows Server 2012.

I tried using MS Windows Task Scheduler, but it keeps creating new instances of the script every time and hence, fills my memory. Currently I run my scripts through command prompt and keep them minimized, and I never log out from the Server.

Any help is really appreciated.


Solution

  • You could use https://learn.microsoft.com/en-US/windows-server/administration/windows-commands/sc-create to create a service then use Scheduled Tasks to control it.