Is it possible to capture a Ctrl+C signal (SIGINT) and run a cleanup function, in a “defer” fashion?
I want to capture the Ctrl+C (SIGINT) signal sent from the console and print out some partial run totals. 10 Answers 10
I want to capture the Ctrl+C (SIGINT) signal sent from the console and print out some partial run totals. 10 Answers 10
Let’s assume we have such a trivial daemon written in python: def mainloop(): while True: # 1. do # 2. some # 3. important # 4. job # 5. sleep mainloop() and we daemonize it using start-stop-daemon which by default sends SIGTERM (TERM) signal on –stop. Let’s suppose the current step performed is #2. And … Read more