Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handling Sleep/Wake events (on Windows) #107

Open
swiftdv8 opened this issue Oct 4, 2017 · 3 comments
Open

Handling Sleep/Wake events (on Windows) #107

swiftdv8 opened this issue Oct 4, 2017 · 3 comments

Comments

@swiftdv8
Copy link

swiftdv8 commented Oct 4, 2017

Not sure if this is a new feature request or something which I have missed in the lib. I am particularly focusing on Windows at the moment though i guess this would be a useful feature across all platforms.

The problem I'm seeing is that my service doesn't properly recover after sleep or hibernation. Googling the problem uncovered this: stack overflow - service hibernation

So it looks like there are events that a service can listen for to provide specific responses to sleep/wake events but I'm curious as to whether these events are exposed in this package and if not are there any plans to add them.

@swiftdv8 swiftdv8 changed the title Handling Sleep/Wake events on Windows Handling Sleep/Wake events (on Windows) Oct 4, 2017
@kardianos
Copy link
Owner

I'm interested in hearing more.

What service behavior are you seeing after you sleep or hibernate? Are the services stopped after sleep/wake? Is the service "running" but the process is not really running?
unning

@swiftdv8
Copy link
Author

swiftdv8 commented Oct 6, 2017

Sorry, it seems my issue wasn't what I thought, My service was logging every minute or so (temporary) I was testing my service and seeing that after sleep/hibernate the logging stopped. I assumed i had to provide specific event handlers to listen and start my service logic loop again on wake.

As I say not as I thought - turns out that hibernate/sleep was un-mounting my external drive with my binary on so the service could not be reached - looking into that now

Happy to close this issue, thanks for the great package

@Muddz
Copy link

Muddz commented Oct 26, 2019

@kardianos @swiftdv8 I'm having the same problem.

I made a loop which logs to a../user/desktop.text file every 30 seconds to see if the Golang program running as a windows service, would still be active in hibernation/sleep mode or when the laptop screen is shut down. The conclusion is it won't.

One would think that a Windows service running in the background would still be active and not stopped. I think there should be some implementation to fix this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants