def __check_min_free_space_on_partition(self, filename):
		# check if enough free space is available
		sfs = statvfs(filename)
		free_disk_space = sfs.f_bavail * sfs.f_frsize / 1024  # kilobyte
		if free_disk_space < self.min_free_space:
			CORE.error('There is not enough free space to upload files.')
			self.setResponseCode(400)
			raise ValueError('There is not enough free space on disk.')
	def failed_request(self, failure, request):
		request.setResponseCode(500)
		request.setHeader('X-UMC-Message', json.dumps(failure.getTraceback()))
		request.respond(dict(result=failure.getErrorMessage()))
		CORE.error('failed_request: %s: %s' % (failure.getErrorMessage(), failure.getTraceback()))
	import sys
	import os.path
	from univention.umc.server import ServerDaemon
	from univention.umc.module import ModuleDaemon

	name = os.path.basename(sys.argv[0])
	try:
		Daemon = {
			'umc-server': ServerDaemon,
			'univention-management-console-server': ServerDaemon,
			'umc-module': ModuleDaemon,
			'univention-management-console-module': ModuleDaemon,
		}[name]
	except KeyError:
		import sys
		raise SystemExit('use umc-server or umc-module! not %s' % sys.argv[0])
	else:
		Daemon()


if __name__ == '__main__':
	try:
		main()
	except (SystemExit, KeyboardInterrupt):
		raise
	except:
		import traceback
		from univention.umc.util import CORE
		CORE.error(traceback.format_exc())
		raise