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

(-)a/services/univention-ad-connector/modules/univention/connector/ad/main.py (-9 / +12 lines)
 Lines 53-58    Link Here 
53
parser.add_option(
53
parser.add_option(
54
	"--configbasename", dest="configbasename",
54
	"--configbasename", dest="configbasename",
55
	help="", metavar="CONFIGBASENAME", default="connector")
55
	help="", metavar="CONFIGBASENAME", default="connector")
56
parser.add_option('-n', '--no-daemon', dest='daemonize', default=True, action='store_false', help='Start process in foreground')
56
(options, args) = parser.parse_args()
57
(options, args) = parser.parse_args()
57
58
58
CONFIGBASENAME = "connector"
59
CONFIGBASENAME = "connector"
 Lines 66-71    Link Here 
66
import mapping
67
import mapping
67
68
68
69
70
def bind_stdout():
71
	if options.daemonize:
72
		sys.stdout = open(STATUSLOGFILE, 'w+')
73
	return sys.stdout
74
75
69
def daemon():
76
def daemon():
70
	try:
77
	try:
71
		pid = os.fork()
78
		pid = os.fork()
 Lines 107-115   def daemon(): Link Here 
107
114
108
115
109
def connect():
116
def connect():
110
117
	f = bind_stdout()
111
	f = open(STATUSLOGFILE, 'w+')
112
	sys.stdout = f
113
	print time.ctime()
118
	print time.ctime()
114
119
115
	baseConfig = ConfigRegistry()
120
	baseConfig = ConfigRegistry()
 Lines 225-232   def connect(): Link Here 
225
	retry_rejected = 0
230
	retry_rejected = 0
226
	connected = True
231
	connected = True
227
	while connected:
232
	while connected:
228
		f = open(STATUSLOGFILE, 'w+')
233
		f = bind_stdout()
229
		sys.stdout = f
230
		print time.ctime()
234
		print time.ctime()
231
		# Aenderungen pollen
235
		# Aenderungen pollen
232
		sys.stdout.flush()
236
		sys.stdout.flush()
 Lines 285-292   def connect(): Link Here 
285
289
286
290
287
def main():
291
def main():
288
292
	if options.daemonize:
289
	daemon()
293
		daemon()
290
294
291
	while True:
295
	while True:
292
		try:
296
		try:
 Lines 294-301   def main(): Link Here 
294
		except SystemExit:
298
		except SystemExit:
295
			raise
299
			raise
296
		except:
300
		except:
297
			f = open(STATUSLOGFILE, 'w+')
301
			f = bind_stdout()
298
			sys.stdout = f
299
			print time.ctime()
302
			print time.ctime()
300
303
301
			text = ''
304
			text = ''

Return to bug 45037