aboutsummaryrefslogtreecommitdiff
path: root/rpki/pubd.py
diff options
context:
space:
mode:
Diffstat (limited to 'rpki/pubd.py')
-rw-r--r--rpki/pubd.py32
1 files changed, 19 insertions, 13 deletions
diff --git a/rpki/pubd.py b/rpki/pubd.py
index 25c2b551..4d8962a7 100644
--- a/rpki/pubd.py
+++ b/rpki/pubd.py
@@ -75,21 +75,27 @@ class main(object):
rpki.log.init("pubd", args)
- self.cfg.set_global_flags()
+ try:
+ self.cfg.set_global_flags()
+
+ if not args.foreground:
+ rpki.daemonize.daemon(pidfile = args.pidfile)
+
+ if self.profile:
+ import cProfile
+ prof = cProfile.Profile()
+ try:
+ prof.runcall(self.main)
+ finally:
+ prof.dump_stats(self.profile)
+ logger.info("Dumped profile data to %s", self.profile)
+ else:
+ self.main()
- if not args.foreground:
- rpki.daemonize.daemon(pidfile = args.pidfile)
+ except:
+ logger.exception("Unandled exception in rpki.pubd.main()")
+ sys.exit(1)
- if self.profile:
- import cProfile
- prof = cProfile.Profile()
- try:
- prof.runcall(self.main)
- finally:
- prof.dump_stats(self.profile)
- logger.info("Dumped profile data to %s", self.profile)
- else:
- self.main()
def main(self):