Lines 67-81
if __name__ == '__main__':
|
Link Here
|
---|
|
67 |
default_debug = MODULE_DEBUG_LEVEL |
67 |
default_debug = MODULE_DEBUG_LEVEL |
68 |
parser.add_option( '-d', '--debug', action = 'store', type = 'int', dest = 'debug', default = default_debug, |
68 |
parser.add_option( '-d', '--debug', action = 'store', type = 'int', dest = 'debug', default = default_debug, |
69 |
help = 'if given then debugging is activated and set to the specified level [default: %default]' ) |
69 |
help = 'if given then debugging is activated and set to the specified level [default: %default]' ) |
70 |
parser.add_option( '-L', '--log-file', action = 'store', dest = 'logfile', default = 'management-console-module', help = 'specifies an alternative log file [default: %default-<module name>.log]' ) |
70 |
parser.add_option( '-L', '--log-file', action = 'store', dest = 'logfile', default = 'management-console-module-%(module)s', help = 'specifies an alternative log file [default: %default-<module name>.log]' ) |
|
|
71 |
parser.add_option('-f', '--foreground', action='store_true', dest='foreground', default=False, help='do not daemonize the process') |
71 |
|
72 |
|
72 |
( options, arguments ) = parser.parse_args() |
73 |
( options, arguments ) = parser.parse_args() |
73 |
|
74 |
|
74 |
daemon = DaemonContext(detach_process=False, prevent_core=False, umask=0077) |
75 |
if not options.foreground: |
75 |
daemon.signal_map = { |
76 |
daemon = DaemonContext(detach_process=False, prevent_core=False, umask=0077) |
76 |
signal.SIGHUP: lambda signal, frame: log_reopen(), |
77 |
daemon.signal_map = { |
77 |
} |
78 |
signal.SIGHUP: lambda signal, frame: log_reopen(), |
78 |
daemon.open() |
79 |
} |
|
|
80 |
daemon.open() |
79 |
|
81 |
|
80 |
# MUST be called after initializing the deamon |
82 |
# MUST be called after initializing the deamon |
81 |
if options.notifier.lower() == 'generic': |
83 |
if options.notifier.lower() == 'generic': |
Lines 86-92
if __name__ == '__main__':
|
Link Here
|
---|
|
86 |
notifier.init( notifier.QT ) |
88 |
notifier.init( notifier.QT ) |
87 |
|
89 |
|
88 |
# init logging |
90 |
# init logging |
89 |
debug_fd = log_init( '%s-%s' % ( options.logfile, options.module ), options.debug ) |
91 |
debug_fd = log_init(options.logfile % {'module': options.module}, options.debug ) |
90 |
# no notifier logging |
92 |
# no notifier logging |
91 |
nflog.instance.handlers = [] |
93 |
nflog.instance.handlers = [] |
92 |
# to activate notifier logging |
94 |
# to activate notifier logging |