Merge branch 'master' of mathias-kettner.de:omd
[omd.git] / packages / maintenance / merge-crontabs
blob4e5f46303c877766b06804374257adf83c7f0eb4
1 #!/usr/bin/env python
2 # This script is part of OMD
3 # Joerg Linge 2010
5 import sys
6 import os
8 omd_config = {}
9 execfile('%s/etc/omd/site.conf' % os.environ['OMD_ROOT'], {}, omd_config)
11 sys.stdout.write("""#
12 # Do not edit this file. It will be recreated each time OMD
13 # is started or reloaded.
15 # execute 'omd reload crontab'
16 # to rebuild this file out of %(omd_root)s/etc/cron.d/*
18 # --ENVIRONMENT------------------------------------------------
19 SHELL=/bin/bash
20 BASH_ENV=%(omd_root)s/.profile
21 """ % {"omd_root": os.environ['OMD_ROOT']})
23 sys.stdout.write("OMD_ROOT=%s\n" % os.environ['OMD_ROOT'])
24 sys.stdout.write("OMD_SITE=%s\n" % os.environ['OMD_SITE'])
25 sys.stdout.write("PATH=%s\n" % os.environ['PATH'])
26 sys.stdout.write("PYTHONPATH=%s\n" % os.environ['PYTHONPATH'])
27 sys.stdout.write("MAILTO=\"%s\"\n" % omd_config.get('CONFIG_ADMIN_MAIL', ''))
28 sys.stdout.write("# ------------------------------------------------------------\n")
31 for fn in sys.argv[1:]:
32 lineno = 0
33 sys.stdout.write("# %s\n" % (fn))
34 for line in file(fn):
35 lineno += 1
36 ls = line.strip()
37 sys.stdout.write(line)
38 sys.stdout.write("# ------------------------------------------------------------\n")