Commit be46966e authored by Jelte Jansen's avatar Jelte Jansen
Browse files

save config data on SIGINT and SIGTERM

git-svn-id: svn:// e5f2f494-b856-4b98-b285-d166d9295462
parent 7a310b66
import ISC
import pickle
import signal
class ConfigData:
def __init__(self):
......@@ -16,6 +17,7 @@ class ConfigManager: = ISC.CC.Session()"ConfigManager")
self.config = ConfigData()
self.running = False
def notify_boss(self):{"running": "configmanager"}, "Boss")
......@@ -71,8 +73,8 @@ class ConfigManager:
return answer
def run(self):
msg = 1
while (msg):
self.running = True
while (self.running):
msg, env =
if msg:
print("received message: ")
......@@ -82,13 +84,23 @@ class ConfigManager:
print(answer), answer)
print("answer sent")
self.running = False
cm = None
def signal_handler(signal, frame):
global cm
if cm:
cm.running = False
if __name__ == "__main__":
print("Hello, BIND10 world!")
db_file = "/tmp/parkinglot.db"
cm = ConfigManager()
signal.signal(signal.SIGINT, signal_handler)
signal.signal(signal.SIGTERM, signal_handler)
# do loading here if necessary
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment