Univention Bugzilla – Attachment 6629 Details for
Bug 37604
start univention-cli-server in foreground
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
patch
37604.patch (text/plain), 3.05 KB, created by
Florian Best
on 2015-01-23 14:21:37 CET
(
hide
)
Description:
patch
Filename:
MIME Type:
Creator:
Florian Best
Created:
2015-01-23 14:21:37 CET
Size:
3.05 KB
patch
obsolete
>diff --git a/ucs-4.0-0/management/univention-directory-manager-modules/univention-cli-server b/ucs-4.0-0/management/univention-directory-manager-modules/univention-cli-server >index c11c1cd..9125f4c 100755 >--- a/ucs-4.0-0/management/univention-directory-manager-modules/univention-cli-server >+++ b/ucs-4.0-0/management/univention-directory-manager-modules/univention-cli-server >@@ -43,6 +43,7 @@ import univention.admincli.adduser > import univention.admincli.admin > import univention.admincli.passwd > import signal >+from argparse import ArgumentParser > try: > import univention.admincli.license_check > licenseImportError = False >@@ -82,18 +83,15 @@ class ForkingTCPServer(SocketServer.ForkingTCPServer): > self.server_port = port > > >-def server_main(): >+def server_main(args): > """UDM command line server.""" >- global logfile >- try: >- logfile = sys.argv[1] >- except IndexError: >- logfile = '/var/log/univention/directory-manager-cmd.log' > > socket_dir = '/tmp/admincli_%s/' % os.getuid() > socket_filename = 'sock' > socket_path = (socket_dir+socket_filename) > >+ global logfile >+ logfile = args.logfile > ud.init(logfile, ud.FLUSH, ud.NO_FUNCTION) > > runfilename = '%s.run' % socket_path >@@ -113,10 +111,7 @@ def server_main(): > print >> sys.stderr, 'E: Server already running [Pid: %s]' % pid > sys.exit(1) > >- configRegistry = ConfigRegistry() >- configRegistry.load() >- debug_level = configRegistry.get('directory/manager/cmd/debug/level', 1) >- ud.set_level(ud.ADMIN, int(debug_level)) >+ ud.set_level(ud.ADMIN, args.debug_level) > ud.debug(ud.ADMIN, ud.INFO, 'daemon [%s] forked to background' % os.getpid()) > > try: >@@ -129,7 +124,7 @@ def server_main(): > else: > print >> sys.stderr, 'E: socket directory exists (%s)' % socket_dir > >- timeout = configRegistry.get('directory/manager/cmd/timeout') >+ timeout = args.timeout > if timeout: > if int(timeout) > 2147483647: > timeout = 2147483647 >@@ -249,13 +244,28 @@ def doit(sarglist, conn): > > > def main(): >- pid = os.fork() >- if pid == 0: # child >- os.setsid() >- server_main() >- sys.exit(0) >- else: # parent >- os.waitpid(pid, os.P_NOWAIT) >+ ucr = ConfigRegistry() >+ ucr.load() >+ debug_level = int(ucr.get('directory/manager/cmd/debug/level', 1)) >+ timeout = int(ucr.get('directory/manager/cmd/timeout', 300)) >+ >+ argparser = ArgumentParser() >+ argparser.add_argument('-n', dest='daemonize', action='store_false', default=True, help='Run in foreground without daemonizing') >+ argparser.add_argument('-L', dest='logfile', action='store', default='/var/log/univention/directory-manager-cmd.log', help='logfile: %(default)s') >+ argparser.add_argument('-d', dest='debug_level', action='store', type=int, default=debug_level, help='debug level: %(default)s') >+ argparser.add_argument('-t', dest='timeout', action='store', type=int, default=timeout, help='timeout: %(default)s') >+ args = argparser.parse_args() >+ >+ if args.daemonize: >+ pid = os.fork() >+ if pid == 0: # child >+ os.setsid() >+ server_main(args) >+ sys.exit(0) >+ else: # parent >+ os.waitpid(pid, os.P_NOWAIT) >+ else: >+ server_main(args) > > if __name__ == "__main__": > main()
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 37604
: 6629