Shell command to relaunch script

41 views
Skip to first unread message

Gnarlodious

unread,
Dec 9, 2011, 11:31:58 AM12/9/11
to mod...@googlegroups.com
Is there a shell command to kill and reload my wsgi app? I have a system to relaunch whenever a module is updated, but it requires one HTTP call to reload. I would prefer a SSH command to reload it when I upload my modules.

Michael P. Jung

unread,
Dec 9, 2011, 11:53:05 AM12/9/11
to mod...@googlegroups.com
It depends on the server setup. Usually touching the WSGI script causes mod_wsgi to reload the script. You could also send the WSGI daemon process a SIGINT signal.


This document explains all the options you have.

Gnarlodious

unread,
Dec 9, 2011, 3:28:29 PM12/9/11
to mod...@googlegroups.com
On my server, I am touching the script from the upload command, it reloads it on first HTTP call, which works.

But on my dev machine I don't have that luxury, I am reloading the application from inside the WSGI script using a SIGINT signal. Problem is, this requires 2 page loads, one to quit the existing process and another to serve up a new page. So it is just a minor irritation.

Possibly some trick to send a Location header to reload the browser after the process has been killed? Just an idea.

This is Apache running WSGI in daemon mode. The page you referred me to doesn't seem to have any shell scripts to relaunch an application. And in any case, I don't understand it very well. It just seems like someone has encountered this problem before and a script exists.

-- Gnarlie

Graham Dumpleton

unread,
Dec 9, 2011, 10:37:57 PM12/9/11
to mod...@googlegroups.com
On 10 December 2011 07:28, Gnarlodious <gnarl...@gmail.com> wrote:
> On my server, I am touching the script from the upload command, it reloads
> it on first HTTP call, which works.
>
> But on my dev machine I don't have that luxury,

Why not? So long as you are using daemon mode of mod_wsgi to run your
application you should be able to touch the WSGI script file no matter
what the setup. If on local box where no upload occurring, you just do
it manually when you have done with a set of changes.

> I am reloading the
> application from inside the WSGI script using a SIGINT signal. Problem is,
> this requires 2 page loads, one to quit the existing process and another to
> serve up a new page. So it is just a minor irritation.
>
> Possibly some trick to send a Location header to reload the browser after
> the process has been killed? Just an idea.
>
> This is Apache running WSGI in daemon mode. The page you referred me to
> doesn't seem to have any shell scripts to relaunch an application. And in
> any case, I don't understand it very well. It just seems like someone has
> encountered this problem before and a script exists.

Go read:

http://blog.dscpl.com.au/2008/12/using-modwsgi-when-developing-django.html

Ignore that it talks about Django, it is just used as an example. The
page in turn refers you to the code monitor for auto reloading in the
document you were referenced by Michael.

Such a code monitor should only be used in a development environment though.

Graham

> -- Gnarlie
>
> --
> You received this message because you are subscribed to the Google Groups
> "modwsgi" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/modwsgi/-/g9Ks7iHR1KAJ.
>
> To post to this group, send email to mod...@googlegroups.com.
> To unsubscribe from this group, send email to
> modwsgi+u...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/modwsgi?hl=en.

Reply all
Reply to author
Forward
0 new messages