View | Details | Raw Unified | Return to bug 33027
Collapse All | Expand All

(-)a/branches/ucs-3.2/ucs-3.2-0/base/univention-base-files/conffiles/etc/cron.d/univention-ucr-cronjobs (-36 / +32 lines)
 Lines 3-55    Link Here 
3
@!@
3
@!@
4
import sys
4
import sys
5
5
6
jobs = []
6
7
def setup_cronjob(key):
7
def collect_cronjobs():
8
	global jobs
8
	jobs = {}
9
	if not key.startswith('cron/') or key == 'cron/autostart' or key == 'cron/path' or key == 'cron/ucrdisabled':
9
	for key, value in configRegistry.items():
10
		return
10
		try:
11
	job = ''
11
			prefix, job, setting = key.split('/')
12
	try:
12
			if prefix == 'cron':
13
		tmp = key.split('/')
13
				jobs.setdefault(job, {})[setting] = value
14
		if len(tmp) != 3:
14
		except ValueError:
15
			raise IndexError()
15
			continue
16
		job = tmp[1]
16
	return jobs
17
	except IndexError:
17
18
		print >> sys.stderr, "E: This cron UCR key is not properly formatted: %s" % key
18
19
		return
19
def process_cronjob(job, settings):
20
	if job not in jobs:
20
		if configRegistry.is_true(value=settings.get("disabled"), default=False):
21
		jobs.append(job)
22
		_tmpkey = 'cron/%s/' % job
23
		time = configRegistry.get(_tmpkey + 'time', None)
24
		command = configRegistry.get(_tmpkey + 'command', None)
25
		description = configRegistry.get(_tmpkey + 'description', None)
26
		user = configRegistry.get(_tmpkey + 'user', 'root')
27
		mailto = configRegistry.get(_tmpkey + 'mailto', user)
28
		disabled = configRegistry.is_true(_tmpkey + 'disabled', False)
29
30
		if disabled:
31
			return
21
			return
32
22
33
		if not (time and command):
23
		try:
24
			time = settings["time"]
25
			command = settings["command"]
26
		except KeyError:
34
			print >> sys.stderr, "E: Time or command is missing for cron job cron/%s" % job
27
			print >> sys.stderr, "E: Time or command is missing for cron job cron/%s" % job
35
			return
28
			return
36
29
37
		print '\n'
30
		print '\n'
38
		if description:
31
		try:
39
			print "# %s" % description
32
			print "# %(description)s" % settings
33
		except KeyError:
34
			pass
35
		user = settings.get("user", "root")
36
		mailto = settings.get("mailto", user)
40
		if mailto == "NONE":
37
		if mailto == "NONE":
41
			mailto = '""'
38
			mailto = '""'
42
		print "MAILTO=%s" % mailto
39
		print "MAILTO=%s" % mailto
43
		print "%s %s %s" % (time, user, command)
40
		print "%s %s %s" % (time, user, command)
44
41
45
path = configRegistry.get('cron/path', '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11:/opt/scalix/bin')
46
print 'PATH="%s"' % path
47
42
48
disabled_globally = configRegistry.is_true('cron/ucrdisabled', False)
43
print 'PATH="%s"' % configRegistry.get('cron/path', '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin')
49
if disabled_globally:
44
50
	print '\n# cron jobs defined by UCR have been disabled by cron/ucr/disabled'
45
if configRegistry.is_true('cron/ucrdisabled', False):
46
	print '\n# cron jobs defined by UCR have been disabled by cron/ucrdisabled'
51
else:
47
else:
52
	for key in configRegistry.keys():
48
	jobs = collect_cronjobs()
53
		if key.startswith('cron/'):
49
	for job, settings in jobs.items():
54
			setup_cronjob(key)
50
		process_cronjob(job, settings)
55
@!@
51
@!@
(-)a/branches/ucs-3.2/ucs-3.2-0/base/univention-base-files/debian/univention-base-files.univention-config-registry-variables (-4 / +16 lines)
 Lines 482-488   Description[en]=Cron jobs can be defined in Univention Configuration Registry. E Link Here 
482
Type=str
482
Type=str
483
Categories=system-base
483
Categories=system-base
484
484
485
[cron/*/time]
485
[cron/*/command]
486
Description[de]=Cron-Jobs können in Univention Configuration Registry definiert werden. Jeder Cron-Job setzt sich dabei aus mehreren Variablen zusammen. Es müssen min. die Variablen 'cron/JOBNAME/command' und 'cron/JOBNAME/time' gesetzt werden. Diese Variable legt den auszuführenden Befehl fest.
486
Description[de]=Cron-Jobs können in Univention Configuration Registry definiert werden. Jeder Cron-Job setzt sich dabei aus mehreren Variablen zusammen. Es müssen min. die Variablen 'cron/JOBNAME/command' und 'cron/JOBNAME/time' gesetzt werden. Diese Variable legt den auszuführenden Befehl fest.
487
Description[en]=Cron jobs can be defined in Univention Configuration Registry. Each cron job is composed of various variables. At least the variables 'cron/JOBNAME/command' and 'cron/JOBNAME/time' must be set. This variable specifies the command to be run.
487
Description[en]=Cron jobs can be defined in Univention Configuration Registry. Each cron job is composed of various variables. At least the variables 'cron/JOBNAME/command' and 'cron/JOBNAME/time' must be set. This variable specifies the command to be run.
488
Type=str
488
Type=str
 Lines 501-517   Type=str Link Here 
501
Categories=system-base
501
Categories=system-base
502
502
503
[cron/*/description]
503
[cron/*/description]
504
Description[de]=Cron-Jobs können in Univention Configuration Registry definiert werden. Jeder Cron-Job setzt sich dabei aus mehreren Variablen zusammen. Es müssen min. die Variablen 'cron/JOBNAME/command' und 'cron/JOBNAME/time' gesetzt werden. Mit dieser Variable kann eine Beschreibung hinterlegt werden. 
504
Description[de]=Cron-Jobs können in Univention Configuration Registry definiert werden. Jeder Cron-Job setzt sich dabei aus mehreren Variablen zusammen. Es müssen min. die Variablen 'cron/JOBNAME/command' und 'cron/JOBNAME/time' gesetzt werden. Mit dieser Variable kann eine Beschreibung hinterlegt werden.
505
Description[en]=Cron jobs can be defined in Univention Configuration Registry. Each cron job is composed of various variables. At least the variables 'cron/JOBNAME/command' and 'cron/JOBNAME/time' must be set. This variable can be used to provide a description.
505
Description[en]=Cron jobs can be defined in Univention Configuration Registry. Each cron job is composed of various variables. At least the variables 'cron/JOBNAME/command' and 'cron/JOBNAME/time' must be set. This variable can be used to provide a description.
506
Type=str
506
Type=str
507
Categories=system-base
507
Categories=system-base
508
508
509
[cron/*/disabled]
510
Description[de]=Cron-Jobs können in Univention Configuration Registry definiert werden. Jeder Cron-Job setzt sich dabei aus mehreren Variablen zusammen. Es müssen min. die Variablen 'cron/JOBNAME/command' und 'cron/JOBNAME/time' gesetzt werden. Mit dieser Variable kann eine Cron-Job deaktiviert werden.
511
Description[en]=Cron jobs can be defined in Univention Configuration Registry. Each cron job is composed of various variables. At least the variables 'cron/JOBNAME/command' and 'cron/JOBNAME/time' must be set. This variable can be used to disable the Cron job.
512
Type=bool
513
Categories=system-base
514
509
[cron/path]
515
[cron/path]
510
Description[de]=Mit dieser Variable kann die PATH-Umgebungsvariable für die in UCR definierten Cron-Job (siehe 'cron/JOBNAME/*') gesetzt werden. Ist die Variable nicht gesetzt, gilt '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11:/opt/scalix/bin'.
516
Description[de]=Mit dieser Variable kann die PATH-Umgebungsvariable für die in UCR definierten Cron-Job (siehe 'cron/JOBNAME/*') gesetzt werden. Ist die Variable nicht gesetzt, gilt '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'.
511
Description[en]=This variable allows the configuration of the PATH environment variable for cron jobs defined in UCR (see 'cron/JOBNAME/*'). If the variable is unset, '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11:/opt/scalix/bin' applies.
517
Description[en]=This variable allows the configuration of the PATH environment variable for cron jobs defined in UCR (see 'cron/JOBNAME/*'). If the variable is unset, '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin' applies.
512
Type=str
518
Type=str
513
Categories=system-base
519
Categories=system-base
514
520
521
[cron/ucrdisabled]
522
Description[de]=Cron-Jobs können in Univention Configuration Registry definiert werden. Mit dieser Variable können alle diese Cron-Jobs deaktiviert werden.
523
Description[en]=Cron jobs can be defined in Univention Configuration Registry. This variable can be used to disable all such Cron jobs.
524
Type=bool
525
Categories=system-base
526
515
[password/quality/credit/digits]
527
[password/quality/credit/digits]
516
Description[de]=Ist die Option 'Passwort-Qualitätsprüfung' für einen Benutzer aktiviert, werden für Passwortänderungen in Samba, Univention Management Console und Kerberos zusätzliche Prüfungen vorgenommen, die auch eine Wörterbuchprüfung beinhalten. Diese Variable konfiguriert die minimale Anzahl von Zahlen, die in dem neuen Passwort vorkommen muss.
528
Description[de]=Ist die Option 'Passwort-Qualitätsprüfung' für einen Benutzer aktiviert, werden für Passwortänderungen in Samba, Univention Management Console und Kerberos zusätzliche Prüfungen vorgenommen, die auch eine Wörterbuchprüfung beinhalten. Diese Variable konfiguriert die minimale Anzahl von Zahlen, die in dem neuen Passwort vorkommen muss.
517
Description[en]=If the option 'Password quality check' is activated for a user, additional checks - including dictionary checks - are performed for password changes in Samba, Univention Management Console and Kerberos. This variable configures the minimum number of digits in the new password.
529
Description[en]=If the option 'Password quality check' is activated for a user, additional checks - including dictionary checks - are performed for password changes in Samba, Univention Management Console and Kerberos. This variable configures the minimum number of digits in the new password.

Return to bug 33027