Author: remi
Date: 2009-03-12 21:14:00 +0100 (Thu, 12 Mar 2009)
New Revision: 4029

Modified:
   software_suite_v2/tuxware/tuxdroidserver/trunk/tuxhttpserver.py
Log:
* reordered start - stop - restart in the program entry point

Modified: software_suite_v2/tuxware/tuxdroidserver/trunk/tuxhttpserver.py
===================================================================
--- software_suite_v2/tuxware/tuxdroidserver/trunk/tuxhttpserver.py     
2009-03-12 20:00:15 UTC (rev 4028)
+++ software_suite_v2/tuxware/tuxdroidserver/trunk/tuxhttpserver.py     
2009-03-12 20:14:00 UTC (rev 4029)
@@ -66,31 +66,25 @@
 # Main
 # 
------------------------------------------------------------------------------
 if __name__ == '__main__':
-    if len(sys.argv) > 1:
-        if sys.argv[1] == "--start":
-            mode = 'START'
-        elif sys.argv[1] == "--restart":
-            mode = 'RESTART'
-        elif sys.argv[1] == "--stop":
-            mode = 'STOP'
-        else:
-            mode = 'START'
-    if mode == 'START':
+    def start():
         if os.name == 'nt': # Windows
             runServer()
         else: # Linux
             from util.daemonizer import Daemonizer
-            tuxDroidDaemon = Daemonizer('tuxhttpserver', '/var/log', runServer,
-                True)
+            tuxDroidDaemon = Daemonizer('tuxhttpserver', '/var/log',
+                runServer, True)
             tuxDroidDaemon.start()
-    elif mode == 'RESTART':
-        killServerAndWait()
-        if os.name == 'nt': # Windows
-            runServer()
-        else: # Linux
-            from util.daemonizer import Daemonizer
-            tuxDroidDaemon = Daemonizer('tuxhttpserver', '/var/log', runServer,
-                True)
-            tuxDroidDaemon.start()
-    elif mode == 'STOP':
-        killServer()
+    # Server called with an argument
+    if len(sys.argv) > 1:
+        if sys.argv[1] == "--start":
+            start()
+        elif sys.argv[1] == "--restart":
+            killServerAndWait()
+            start()
+        elif sys.argv[1] == "--stop":
+            killServer()
+        else:
+            start()
+    # Without argument : Server start
+    else:
+        start()


------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
Tux-droid-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tux-droid-svn

Reply via email to