From 784496248a7eaecea2e9cc6dad1d62dd30dccb15 Mon Sep 17 00:00:00 2001 From: martinko Date: Fri, 19 Oct 2012 12:32:29 +0200 Subject: skytools.scripting: added start-up time attribute --- python/skytools/scripting.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'python/skytools/scripting.py') diff --git a/python/skytools/scripting.py b/python/skytools/scripting.py index 004cacfb..aba4842d 100644 --- a/python/skytools/scripting.py +++ b/python/skytools/scripting.py @@ -456,6 +456,14 @@ class BaseScript(object): sys.exit(1) self.last_sigint = t + def stat_get(self, key): + """Reads a stat value.""" + try: + value = self.stat_dict[key] + except KeyError: + value = None + return value + def stat_put(self, key, value): """Sets a stat value.""" self.stat_dict[key] = value @@ -597,6 +605,7 @@ class BaseScript(object): In case of daemon, if will be called in same process as work(), unlike __init__(). """ + self.started = time.time() # set signals if hasattr(signal, 'SIGHUP'): -- cgit v1.2.3