What about Kushal's suggestion above? Does the following work for you?
signal.signal(signal.SIGTERM, my_SIGTERM_handler)
signal.siginterrupt(signal.SIGTERM, flag=False)
According to the siginterrupt docs (
http://docs.python.org/library/signal.html)
"""
Change system call restart behaviour: if fl
On Fri, Jul 20, 2012 at 1:51 AM, Jason Friedman wrote:
> > This seems to work okay but just now I got this while hitting ctrl-c
> > It seems to have caught the signal at or in the middle of a call to
> > sys.stdout.flush()
> >
> >
> > --- Caught SIGTERM; Attempting to quit gracefully ---
> > Trac
On Fri, Jul 20, 2012 at 11:39 AM, Dieter Maurer wrote:
> Eric Frederich writes:
>> ...
>> This seems to work okay but just now I got this while hitting ctrl-c
>> It seems to have caught the signal at or in the middle of a call to
>> sys.stdout.flush()
>> --- Caught SIGTERM; Attempting to quit gra
Eric Frederich writes:
> ...
> This seems to work okay but just now I got this while hitting ctrl-c
> It seems to have caught the signal at or in the middle of a call to
> sys.stdout.flush()
> --- Caught SIGTERM; Attempting to quit gracefully ---
> Traceback (most recent call last):
> File "/hom
So I wrote a script which acts like a daemon.
And it starts with something like this
### Begin Code
import signal
STOPIT = False
def my_SIGTERM_handler(signum, frame):
global STOPIT
print '\n--- Caught SIGTERM; Attempting to quit gracefully ---'
STOPIT = True
signal.sig