-
Force server restart
Hi,
I was wondering if it possible to force a restart of the mobile web server from python code?
I guess starting a server instance with e32.start_exe() is probably not much of a problem, but how to kill the current running thread? And preferably there would some better solution.
If anyone have any thoughts please let me know.
best regards,
Magnus
-
Re: Force server restart
Hi,
[QUOTE=maggias;447499]
I was wondering if it possible to force a restart of the mobile web server from python code?
[/quote]
What exactly do mean by restarting? Forcing Apache to release all resources and close all connections, and reread the config file and do a logical restart, or causing the process to exist and restart?
[quote]
I guess starting a server instance with e32.start_exe() is probably not much of a problem,
[/quote]
In this case it would be, because Apache runs in one (or more) separate threads inside a Symbian server. That is, merely starting the process is not enough, you need to connect to it and instruct it to start Apache.
[quote]
but how to kill the current running thread? And preferably there would some better solution.
[/quote]
Assuming you want to tweak [I]httpd.conf[/I] from a request handler and then cause Apache to take those settings into use, one approach would be to have Apache do a logical restart. And the best way for that would be to create a Python extension for [url=http://raccoon.svn.sourceforge.net/viewvc/raccoon/phone/tags/httpd-2.2.4_1.0.1/symbian/public/mws/rhttpd.h?revision=1052&view=markup]RHttpd.h[/url] or [url=http://raccoon.svn.sourceforge.net/viewvc/raccoon/phone/tags/httpd-2.2.4_1.0.1/symbian/public/mws/chttpd.h?revision=1052&view=markup]CHttpd[/url]. That would allow you to call [I]restart[/I] from the request handler, which would have the effect of causing Apache to do a logical restart [I]after[/I] the current request has been processed completely.
Doing such a Python extension has been on my todo-list for ages, but I just haven't gotten around doing it.
Johan
-
Re: Force server restart
Hi,
Basically I want the same effect as when I "stop server" / "start server" from the Web Server GUI.
What I am really interested in though is to clear the memory.
When I have a python script implementing a object and then update the script I have noticed that the "old" object is executed until the server has been restarted. If the script has been run at least once before updating the .py file.
So it seems like python compiles the object and stores it in memory after first execution, which is great in most situations, but not when updating the code and stuff like that.
But maybe this would be solved by simply copying .pyc files to the device instead of .py source files, I haven't tried that.
Otherwise it seems to me that your last two paragraphs describe the appropriate solution.