[Erp5-report] r44930 luke - /erp5/trunk/utils/slapos.recipe.erp5/src/slapos/recipe/erp5/

nobody at svn.erp5.org nobody at svn.erp5.org
Thu Mar 31 18:01:27 CEST 2011


Author: luke
Date: Thu Mar 31 18:01:27 2011
New Revision: 44930

URL: http://svn.erp5.org?rev=44930&view=rev
Log:
 - install and expose self.cron_d to register cron tasks by recipe

Modified:
    erp5/trunk/utils/slapos.recipe.erp5/src/slapos/recipe/erp5/__init__.py

Modified: erp5/trunk/utils/slapos.recipe.erp5/src/slapos/recipe/erp5/__init__.py
URL: http://svn.erp5.org/erp5/trunk/utils/slapos.recipe.erp5/src/slapos/recipe/erp5/__init__.py?rev=44930&r1=44929&r2=44930&view=diff
==============================================================================
--- erp5/trunk/utils/slapos.recipe.erp5/src/slapos/recipe/erp5/__init__.py [utf8] (original)
+++ erp5/trunk/utils/slapos.recipe.erp5/src/slapos/recipe/erp5/__init__.py [utf8] Thu Mar 31 18:01:27 2011
@@ -52,6 +52,8 @@ class Recipe(BaseSlapRecipe):
   def _install(self):
     self.path_list = []
     self.requirements, self.ws = self.egg.working_set([__name__])
+    # self.cron_d is a directory, where cron jobs can be registered
+    self.cron_d = self.installCrond()
     ca_conf = self.installCertificateAuthority()
     memcached_conf = self.installMemcached(ip=self.getLocalIPv4Address(),
         port=11000)
@@ -194,6 +196,22 @@ class Recipe(BaseSlapRecipe):
         )])[0]
     self.path_list.append(runUnitTest)
 
+  def installCrond(self):
+    timestamps = self.createDataDirectory('cronstamps')
+    cron_d = os.path.join(self.var_directory, 'cron.d')
+    crontabs = os.path.join(self.var_directory, 'crontabs')
+    logfile = os.path.join(self.log_directory, 'cron.log')
+    self._createDirectory(cron_d)
+    self._createDirectory(crontabs)
+    wrapper = zc.buildout.easy_install.scripts([('crond',
+      __name__ + '.execute', 'execute')], self.ws, sys.executable,
+      self.wrapper_directory, arguments=[
+        self.options['dcrond_binary'].strip(), '-s', cron_d, '-c', crontabs,
+        '-t', timestamps, '-L', logfile, '-f', '-l', '10']
+      )[0]
+    self.path_list.append(wrapper)
+    return cron_d
+
   def installCertificateAuthority(self, ca_country_code='XX',
       ca_email='xx at example.com', ca_state='State', ca_city='City',
       ca_company='Company'):



More information about the Erp5-report mailing list