views:

47

answers:

2

I am running a Python script as a Windows service, but it seems to be failing whenever I set it to auto-start. I believe this may be because the service uses network resources that are not yet mounted when the service starts. Is there a way I can get it to wait until startup is complete before running?

+2  A: 

Add in script wait for the resources who script must use is in good standing, or rewrite script to better design like not exit if dont have connection; wait 1s and try again if connection failed.

Svisstack
You're right, of course. I think I was just being lazy and not wanting to debug what's actually going wrong. But of course, I will!
psicopoo
+7  A: 

Configure your Windows Service so that it has the Workstation Service as a dependency.

This means Windows won't attempt to start your service until the appropriate resources are available.

Dave Webb
I should really read more about Windows internals, I'm always surprised when I find out that things like this exist :-\
Dana the Sane