[omd-commits] OMD Git: omd: crontab: add OMD_ROOT and OMD_SITE vars to crontab

git version control git at mathias-kettner.de
Thu Dec 23 09:03:13 CET 2010


Module: omd
Branch: master
Commit: 14ea19f02fff38be9af0d0ae8c6b073f22f66007
URL:    http://omdistro.org/projects/omd/repository/revisions/14ea19f02fff38be9af0d0ae8c6b073f22f66007

Author: Joerg Linge <pitchfork at pnp4nagios.org>
Date:   Thu Dec 16 21:12:40 2010 +0100

crontab: add OMD_ROOT and OMD_SITE vars to crontab

---

 packages/maintenance/merge-crontabs            |   14 ++++++++++++--
 packages/maintenance/skel/etc/cron.d/logrotate |    2 +-
 2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/packages/maintenance/merge-crontabs b/packages/maintenance/merge-crontabs
index 388d881..e0a35f9 100755
--- a/packages/maintenance/merge-crontabs
+++ b/packages/maintenance/merge-crontabs
@@ -3,13 +3,23 @@
 # Joerg Linge 2010
 #
 import sys
+import os
 
 sys.stdout.write("""#
 # Do not edit this file. It will be recreated each time OMD 
 # is started or reloaded. 
 # 
-# ------------------------------------------------------------
-""")
+# execute 'omd reload crontab' 
+# to rebuild this file out of %s/etc/cron.d/*
+# 
+# --ENVIRONMENT------------------------------------------------
+""" % os.environ['OMD_ROOT'])
+
+sys.stdout.write("OMD_ROOT=%s\n" % os.environ['OMD_ROOT'])
+sys.stdout.write("OMD_SITE=%s\n" % os.environ['OMD_SITE'])
+sys.stdout.write("PATH=%s\n" % os.environ['PATH'])
+sys.stdout.write("# ------------------------------------------------------------\n")
+
 
 for fn in sys.argv[1:]:
     lineno = 0
diff --git a/packages/maintenance/skel/etc/cron.d/logrotate b/packages/maintenance/skel/etc/cron.d/logrotate
index 139212d..38199ab 100644
--- a/packages/maintenance/skel/etc/cron.d/logrotate
+++ b/packages/maintenance/skel/etc/cron.d/logrotate
@@ -1,4 +1,4 @@
 #
 # Daily Logrotate
 #
-0 0 * * * [ -x /usr/sbin/logrotate ] && /usr/sbin/logrotate -s ###ROOT###/tmp/run/logrotate.state ###ROOT###/etc/logrotate.conf >/dev/null 2>&1
+0 0 * * * /usr/sbin/logrotate -s $OMD_ROOT/tmp/run/logrotate.state $OMD_ROOT/etc/logrotate.conf >/dev/null 2>&1



More information about the omd-commits mailing list