summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lib/Server/Core.py16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/lib/Server/Core.py b/src/lib/Server/Core.py
index b481033c4..09dd1d086 100644
--- a/src/lib/Server/Core.py
+++ b/src/lib/Server/Core.py
@@ -5,11 +5,16 @@ from os import stat
from stat import ST_MODE, S_ISDIR
from syslog import syslog, LOG_ERR
-from Error import PublishError
from Types import Clause
import _fam
+class GeneratorError(Exception):
+ pass
+
+class PublishError(Exception):
+ pass
+
class fam(object):
'''The fam object contains alteration monitors'''
@@ -56,6 +61,7 @@ class Core(object):
self.fam = fam()
self.pubspace = {}
self.structures = []
+ self.cron = {}
for structure in structures:
m = getattr(__import__("Bcfg2.Server.Structures.%s"%(structure)).Server.Structures, structure)
s = getattr(m, structure)
@@ -111,3 +117,11 @@ class Core(object):
print g, "failed"
raise KeyError, (entry.tag,entry.attrib['name'])
+ def RunCronTasks(self):
+ g = [x for x in self.generators if x.__croninterval__]
+ for generator in g:
+ t = time()
+ if ((t - self.cron.get(generator,0)) > generator.__croninterval__):
+ generator.Cron()
+ self.cron[generator] = t
+