Author: ks156
Date: 2009-03-13 20:37:12 +0100 (Fri, 13 Mar 2009)
New Revision: 4066
Modified:
software_suite_v2/tuxware/tuxdroidserver/trunk/tuxhttpserver.py
Log:
* Improved the options
* Added a new long option --no-daemon to disable the daemonization (only for
linux). it will help for the debugging.
Modified: software_suite_v2/tuxware/tuxdroidserver/trunk/tuxhttpserver.py
===================================================================
--- software_suite_v2/tuxware/tuxdroidserver/trunk/tuxhttpserver.py
2009-03-13 19:35:43 UTC (rev 4065)
+++ software_suite_v2/tuxware/tuxdroidserver/trunk/tuxhttpserver.py
2009-03-13 19:37:12 UTC (rev 4066)
@@ -76,6 +76,8 @@
print ' -l , --start : Start the server'
print ' -r , --restart : Restart the server'
print ' -h , --help : Display this help'
+ print " --no-daemon : Don't daemonize the server"
+ print ' (only for Linux)'
print ''
print '-'*80
print ''
@@ -88,14 +90,22 @@
if os.name == 'nt': # Windows
runServer()
else: # Linux
- from util.daemonizer import Daemonizer
- tuxDroidDaemon = Daemonizer('tuxhttpserver', '/var/log',
- runServer, True)
- tuxDroidDaemon.start()
+ if __daemon:
+ from util.daemonizer import Daemonizer
+ tuxDroidDaemon = Daemonizer('tuxhttpserver', '/var/log',
+ runServer, True)
+ tuxDroidDaemon.start()
+ else:
+ runServer()
+ __start = False
+ __stop = False
+ __restart = False
+ __daemon = True
+
try:
opts, args = getopt.getopt(sys.argv[1:], "slrh", \
- ["stop", "start", "restart", "help"])
+ ["stop", "start", "restart", "help", "no-daemon"])
except getopt.error, msg:
print msg
usage()
@@ -105,12 +115,26 @@
if o in ("-h", "--help"):
usage()
sys.exit(0)
- if o in ("-s", "--stop"):
- killServer()
+ elif o in ("-s", "--stop"):
+ __stop = True
elif o in ("-l", "--start"):
- start()
+ __start = True
elif o in ("-r", "--restart"):
- killServerAndWait()
- start()
- else:
- start()
+ __start = True
+ __restart = True
+ elif o in ("--no-daemon"):
+ __daemon = False
+
+ if __start and __stop:
+ print "--start or --restart and --stop are exclusive options"
+ print "Couldn't determine what should be done.. so, exiting."
+ sys.exit(2)
+
+ if __stop:
+ killServer()
+ elif __restart:
+ killServerAndWait()
+ 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