Author: remi
Date: 2009-05-27 16:06:34 +0200 (Wed, 27 May 2009)
New Revision: 4688
Modified:
software_suite_v3/smart-core/smart-server/trunk/resources/00_smart_server_base/00_resourceServer.py
Log:
* added command to restart the server
* TODO : linux.
Modified:
software_suite_v3/smart-core/smart-server/trunk/resources/00_smart_server_base/00_resourceServer.py
===================================================================
---
software_suite_v3/smart-core/smart-server/trunk/resources/00_smart_server_base/00_resourceServer.py
2009-05-27 09:49:31 UTC (rev 4687)
+++
software_suite_v3/smart-core/smart-server/trunk/resources/00_smart_server_base/00_resourceServer.py
2009-05-27 14:06:34 UTC (rev 4688)
@@ -25,6 +25,14 @@
"""
httpServer.stop()
+ def restartServer(self):
+ """Restart the server.
+ """
+ # TODO: Restart on linux
+ if os.name == 'nt':
+ t = threading.Thread(target = os.system, args =
["tuxhttpserver_restart.exe",])
+ t.start()
+
def getVersion(self):
"""Get the server version.
@return: The server version.
@@ -59,6 +67,28 @@
resourceServer.addService(TDSServiceServerStop)
#
------------------------------------------------------------------------------
+# Declaration of the service "restart".
+#
------------------------------------------------------------------------------
+class TDSServiceServerRestart(TDSService):
+
+ def configure(self):
+ self.parametersDict = {}
+ self.minimalUserLevel = TDS_CLIENT_LEVEL_ANONYMOUS
+ self.exclusiveExecution = False
+ self.name = "restart"
+ self.comment = "Restart the server."
+
+ def execute(self, id, parameters):
+ headersStruct = self.getDefaultHeadersStruct()
+ contentStruct = self.getDefaultContentStruct()
+ contentStruct['root']['result'] = getStrError(E_TDREST_SUCCESS)
+ resourceServer.restartServer()
+ return headersStruct, contentStruct
+
+# Register the service into the resource
+resourceServer.addService(TDSServiceServerRestart)
+
+#
------------------------------------------------------------------------------
# Declaration of the service "version".
#
------------------------------------------------------------------------------
class TDSServiceServerVersion(TDSService):
------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, &
iPhoneDevCamp as they present alongside digital heavyweights like Barbarian
Group, R/GA, & Big Spaceship. http://p.sf.net/sfu/creativitycat-com
_______________________________________________
Tux-droid-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tux-droid-svn