> On 11/06/2011 07:58 AM, Roberto De Ioris wrote: >> >>> Hi, >>> >>> I try to setup a new server with uwsgi. >>> >>> Everything works fine, but at the moment my startup procedure is not >>> that satisfactory. >>> >>> Before I start uwsgi I want to start two python scripts which will be >>> active for the whole life time of uwsgi >>> >>> - one is kind of a logging service >>> - and the other one is responsable for handling a task >>> queue of slow tasks. >>> >>> Now I wondered whether there is an easy way to configure uwsgi such, >>> that it will start these two programs automatically when it is started >>> and that it will kill them automatically when it will be stopped. >>> >>> Or should I better handle this in my init script?? >>> >> >> Use the --attach-daemon directive >> ex. >> >> --attach-daemon mypythonscript.py >> >> > > --attach-daemon works file. > > I created a small python script spawning one child process. > > > Now I have just problems stopping uwsgi such, that the daemon > ( AND it's child processes are killed) > > uwsgi seems to kill the daemon process as expected, however > the child processes stay alive. > > What I can see is the message: > > SIGINT/SIGQUIT received...killing workers... > > and that my daemon process dies. > The children however won't die > > > I added signals handlers for all possible signals and I don't seem to > receive any. > So I don't know how I could ask the daemon to kill its children at > shutdown. > > Is there any trick? > >
attach-daemon create a new process group, so if you call fork() and simply run code the children will be killed too. How do you create children ? If you call setsid(), a new process group will be created so uWSGI will not be able to kill them. -- Roberto De Ioris http://unbit.it _______________________________________________ uWSGI mailing list [email protected] http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi
