summaryrefslogtreecommitdiffstats
path: root/ipa-server/ipa-gui/ipa-webgui
diff options
context:
space:
mode:
authorRob Crittenden <rcritten@redhat.com>2007-11-01 11:55:53 -0400
committerRob Crittenden <rcritten@redhat.com>2007-11-01 11:55:53 -0400
commita51dd58278126a81b1b923c528488d3580adba39 (patch)
tree79b78847d67a17ddf7e523abfdf47e91aef4ce3d /ipa-server/ipa-gui/ipa-webgui
parentd9f809746bba7a818e584a5729ecc4b664efb78f (diff)
downloadfreeipa-a51dd58278126a81b1b923c528488d3580adba39.tar.gz
freeipa-a51dd58278126a81b1b923c528488d3580adba39.tar.xz
freeipa-a51dd58278126a81b1b923c528488d3580adba39.zip
TurboGears log files and log rotation
The error log is rotated weekly on Sunday. 4 backups are saved. The access log is not stored since it would be a duplicate of the Apache logs. It can be enabled if desired. Had to move the call to daemonize() in ipa-webgui so that the fork is done before TurboGears is initialized. Otherwise the log files end up getting closed.
Diffstat (limited to 'ipa-server/ipa-gui/ipa-webgui')
-rw-r--r--ipa-server/ipa-gui/ipa-webgui33
1 files changed, 19 insertions, 14 deletions
diff --git a/ipa-server/ipa-gui/ipa-webgui b/ipa-server/ipa-gui/ipa-webgui
index f16089088..c8e3d0589 100644
--- a/ipa-server/ipa-gui/ipa-webgui
+++ b/ipa-server/ipa-gui/ipa-webgui
@@ -20,14 +20,24 @@
import os, sys
def daemonize():
- pid = os.fork()
+ # fork once so the parent can exit
+ try:
+ pid = os.fork()
+ except OSError, e:
+ raise Exception, "%s [%d]" % (e.strerror, e.errno)
+
if pid != 0:
os._exit(0)
+
# become session leader
os.setsid()
# fork again to reparent to init
- pid = os.fork()
+ try:
+ pid = os.fork()
+ except OSError, e:
+ raise Exception, "%s [%d]" % (e.strerror, e.errno)
+
if pid != 0:
os._exit(0)
@@ -60,6 +70,13 @@ devel = False
if os.path.exists(os.path.join(os.path.dirname(__file__), "Makefile.am")):
devel = True
+if not devel:
+ try:
+ daemonize()
+ except Exception, e:
+ sys.stderr.write("error becoming daemon: " + str(e))
+ sys.exit(1)
+
sys.path.append("/usr/share/ipa/")
# this must be after sys.path is changed to work correctly
@@ -83,16 +100,4 @@ else:
from ipagui.controllers import Root
-if not devel:
- try:
- daemonize()
- except Exception, e:
- sys.stderr.write("error becoming daemon: " + str(e))
- sys.exit(1)
-
start_server(Root())
-
-
-
-
-