Don't forget to exit() on SIGTERM
This commit is contained in:
parent
07689f87cb
commit
6944f3f898
1 changed files with 5 additions and 1 deletions
|
@ -23,4 +23,8 @@ class Daemon():
|
|||
with open(pidfile, 'w') as fh:
|
||||
print(str(os.getpid()), file=fh)
|
||||
|
||||
signal.signal(signal.SIGTERM, lambda s, f: os.unlink(pidfile))
|
||||
def stop(sig, trace):
|
||||
os.unlink(pidfile)
|
||||
exit(0)
|
||||
|
||||
signal.signal(signal.SIGTERM, stop)
|
||||
|
|
Loading…
Add table
Reference in a new issue