summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--funcweb/funcweb/commands.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/funcweb/funcweb/commands.py b/funcweb/funcweb/commands.py
index 578fe23..154309a 100644
--- a/funcweb/funcweb/commands.py
+++ b/funcweb/funcweb/commands.py
@@ -11,6 +11,7 @@ pkg_resources.require("TurboGears")
import turbogears
import cherrypy
+import func.utils as futils
cherrypy.lowercase_api = True
@@ -56,5 +57,12 @@ def start():
modulename="funcweb.config")
from funcweb.controllers import Root
-
- turbogears.start_server(Root())
+
+ if exists("/etc/funcweb/prod.cfg"):
+ futils.daemonize("/var/run/funcwebd.pid")
+ #then start the server
+ try:
+ turbogears.start_server(Root())
+ except Exception,e:
+ print "Exception occured :",e
+ sys.exit(1)