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

nobody at svn.erp5.org nobody at svn.erp5.org
Fri Apr 22 14:47:51 CEST 2011


Author: luke
Date: Fri Apr 22 14:47:51 2011
New Revision: 45640

URL: http://svn.erp5.org?rev=45640&view=rev
Log:
 - catch cron output and out them in var/log/cron-output

Added:
    erp5/trunk/utils/slapos.recipe.erp5/src/slapos/recipe/erp5/catdatefile.py
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=45640&r1=45639&r2=45640&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] Fri Apr 22 14:47:51 2011
@@ -257,6 +257,11 @@ class Recipe(BaseSlapRecipe):
 
   def installCrond(self):
     timestamps = self.createDataDirectory('cronstamps')
+    cron_output = os.path.join(self.log_directory, 'cron-output')
+    self._createDirectory(cron_output)
+    catcher = zc.buildout.easy_install.scripts([('catchcron',
+      __name__ + '.catdatefile', 'catdatefile')], self.ws, sys.executable,
+      self.bin_directory, arguments=[cron_output])[0]
     cron_d = os.path.join(self.etc_directory, 'cron.d')
     crontabs = os.path.join(self.etc_directory, 'crontabs')
     self._createDirectory(cron_d)
@@ -265,7 +270,7 @@ class Recipe(BaseSlapRecipe):
       __name__ + '.execute', 'execute')], self.ws, sys.executable,
       self.wrapper_directory, arguments=[
         self.options['dcrond_binary'].strip(), '-s', cron_d, '-c', crontabs,
-        '-t', timestamps, '-f', '-l', '6', '-M', '/bin/true']
+        '-t', timestamps, '-f', '-l', '6', '-M', catcher]
       )[0]
     self.path_list.append(wrapper)
     return cron_d

Added: erp5/trunk/utils/slapos.recipe.erp5/src/slapos/recipe/erp5/catdatefile.py
URL: http://svn.erp5.org/erp5/trunk/utils/slapos.recipe.erp5/src/slapos/recipe/erp5/catdatefile.py?rev=45640&view=auto
==============================================================================
--- erp5/trunk/utils/slapos.recipe.erp5/src/slapos/recipe/erp5/catdatefile.py (added)
+++ erp5/trunk/utils/slapos.recipe.erp5/src/slapos/recipe/erp5/catdatefile.py [utf8] Fri Apr 22 14:47:51 2011
@@ -0,0 +1,14 @@
+import os
+import sys
+import time
+def catdatefile(args):
+  directory = args[0]
+  try:
+    suffix = args[1]
+  except IndexError:
+    suffix = '.log'
+  f = open(os.path.join(directory,
+    time.strftime('%Y-%m-%d.%H:%M.%s') + suffix), 'aw')
+  for line in sys.stdin.read():
+    f.write(line)
+  f.close()



More information about the Erp5-report mailing list