summaryrefslogtreecommitdiffstats
path: root/GitAutoDeploy.py
diff options
context:
space:
mode:
authorlogsol <fartman@gmx.de>2011-12-26 12:47:53 +0100
committerlogsol <fartman@gmx.de>2011-12-26 12:47:53 +0100
commitf4f7e365c571f48cbf577a8cd66634b9138bf56e (patch)
tree709c524ab32c2f7ca666589581f71dfa62d4d313 /GitAutoDeploy.py
parente55582ff0b8874e96796070faff2dcc250df09a2 (diff)
downloadGit-Auto-Deploy-f4f7e365c571f48cbf577a8cd66634b9138bf56e.zip
Git-Auto-Deploy-f4f7e365c571f48cbf577a8cd66634b9138bf56e.tar.gz
Git-Auto-Deploy-f4f7e365c571f48cbf577a8cd66634b9138bf56e.tar.bz2
added deamon mode
Diffstat (limited to 'GitAutoDeploy.py')
-rw-r--r--GitAutoDeploy.py20
1 files changed, 16 insertions, 4 deletions
diff --git a/GitAutoDeploy.py b/GitAutoDeploy.py
index 8277bd2..5cc3469 100644
--- a/GitAutoDeploy.py
+++ b/GitAutoDeploy.py
@@ -7,6 +7,7 @@ class GitAutoDeploy(BaseHTTPRequestHandler):
CONFIG_FILEPATH = './GitAutoDeploy.conf.json'
config = None
quiet = False
+ deamon = False
@classmethod
def getConfig(myClass):
@@ -75,18 +76,29 @@ class GitAutoDeploy(BaseHTTPRequestHandler):
def main():
try:
+ server = None
for arg in sys.argv:
if(arg == '-d' or arg == '--deamon-mode'):
- GitAutoDeploy.quiet = True
+ GitAutoDeploy.deamon = True
+ GitAutoDeploy.quiet = True
+ if(arg == '-q' or arg == '--quiet'):
+ GitAutoDeploy.quiet = True
+
+ if(GitAutoDeploy.deamon):
+ pid = os.fork()
+ if(pid != 0):
+ sys.exit()
+ os.setsid()
- server = None
if(not GitAutoDeploy.quiet):
print 'Github Autodeploy Service v 0.1 started'
-
+ else:
+ print 'Github Autodeploy Service v 0.1 started in deamon mode'
+
server = HTTPServer(('', GitAutoDeploy.getConfig()['port']), GitAutoDeploy)
server.serve_forever()
except (KeyboardInterrupt, SystemExit) as e:
- if(e):
+ if(e): # wtf, why is this creating a new line?
print >> sys.stderr, e
if(not server is None):