Support proper sigterm exiting
This commit is contained in:
parent
9d4f773b94
commit
261d9394db
4
pvcd.py
4
pvcd.py
|
@ -24,6 +24,7 @@ import kazoo.client
|
||||||
import libvirt
|
import libvirt
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
|
import signal
|
||||||
import socket
|
import socket
|
||||||
import psutil
|
import psutil
|
||||||
import subprocess
|
import subprocess
|
||||||
|
@ -120,6 +121,9 @@ def cleanup():
|
||||||
zk.close()
|
zk.close()
|
||||||
update_timer.shutdown()
|
update_timer.shutdown()
|
||||||
|
|
||||||
|
# Handle SIGTERM gracefully
|
||||||
|
signal.signal(signal.SIGTERM, cleanup)
|
||||||
|
|
||||||
# Gather useful data about our host for staticdata
|
# Gather useful data about our host for staticdata
|
||||||
# Static data format: 'cpu_count', 'arch', 'os', 'kernel'
|
# Static data format: 'cpu_count', 'arch', 'os', 'kernel'
|
||||||
staticdata = []
|
staticdata = []
|
||||||
|
|
Loading…
Reference in New Issue