Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1094041
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T23:55:00+00:00 2026-05-16T23:55:00+00:00

I followed the instructions in this answer about writing a Python script to be

  • 0

I followed the instructions in this answer about writing a Python script to be used as a service. I placed my looping code in def main().

I installed the service with python my_script.py install. I was able to Start and Stop the service through services.msc in Windows XP.

It’s a logging program that is intended to write logs as long as Windows is running. It shouldn’t care about who or whether anyone logs in or out. My problem is that the service will stop when I logout. How do I make it survive logouts?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T23:55:01+00:00Added an answer on May 16, 2026 at 11:55 pm

    The system generates CTRL_CLOSE_EVENT, CTRL_LOGOFF_EVENT, and CTRL_SHUTDOWN_EVENT signals when the user closes the console, logs off, or shuts down the system so that the process has an opportunity to clean up before termination. To ensure that you detach your service from all this, you will need to use the control handler to set it that way:

      win32api.SetConsoleCtrlHandler(lambda x: True, True)  
    

    Check out : http://msdn.microsoft.com/en-us/library/ms685049(v=VS.85).aspx

    Just checked out that there is recipe that illustrates this very well for you.

    • http://code.activestate.com/recipes/551780-win-services-helper/
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I followed the instructions in this site but there's no such code inside the
I have followed the Accepted Answer's instructions from this post as regards creating a
I followed the instructions in the marked answer here to create a service. The
I've followed instructions from this question on SO to set up RVM, rubies and
I followed the instructions in this post and this fiddle but I am confused
I've followed the instructions in this MSDN article: http://msdn.microsoft.com/en-us/library/dd206945.aspx Is it possible to call
I'm trying to upgrade to Node v0.6.17. I followed the instructions in this post:
I'm a bit mystified as to how to do this. I have followed instructions
I followed the instructions: create the bean. This bean is for an enum transferred
Is this possible? I've followed the instructions from here ( http://www.jetbrains.net/confluence/display/TCD4/Setting+up+an+External+Database#SettingupanExternalDatabase-MicrosoftSQLServer2005 ) but I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.