Answer the question
In order to leave comments, you need to log in
Intercepting the shutdown, sleep event in Windows?
Hi all!
The program is launched via vbs via autorun, performs some data processing work,
saves the state in the database in a separate thread with an interval of n seconds. I would like to redo it a little, make it so that at startup
data is loaded from the database into structures, and when the computer shuts down or goes into sleep mode or by pressing Ctrl-C, the structures are saved back to the database.
Signal initialization is something like this
c := make(chan os.Signal)
signal.Notify(c, os.Interrupt, os.Kill, syscall.SIGTERM)
Answer the question
In order to leave comments, you need to log in
but can't it be that you need to listen to syscall.SIGKILL and syscall.SIGINT? (no Windows at hand)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question