=== jY- is now known as jY | ||
zyga | hi | 12:56 |
---|---|---|
zyga | I need to shut down uwsgi server from upstart, the problem is that the server expects SIGQUIT, not SIGTERM | 12:56 |
zyga | I have not found a way to configure the signal sent by upstart so I'm trying to achieve the same with pre-stop script | 12:57 |
zyga | how can I know the PID of the main task from the pre-stop script? | 12:57 |
zyga | jhunt_, ping | 13:00 |
zyga | jhunt_, ping | 14:18 |
jhunt_ | zyga: hi | 14:18 |
zyga | jhunt_, can I have one job say "start on starting master-job INSTANCE=$INSTANCE" | 14:18 |
zyga | jhunt_, I have instances everywhere | 14:18 |
zyga | jhunt_, I wanted to have one master job per instance | 14:19 |
jhunt_ | zyga: have you seen http://upstart.ubuntu.com/cookbook/#instance ? | 14:19 |
zyga | jhunt_, then a few actual jobs with daemons/processes that do particular aspect of that instance | 14:19 |
zyga | jhunt_, I read the cookbook (still staring at it) | 14:19 |
zyga | jhunt_, it just that it does not work in practice when I try | 14:19 |
zyga | jhunt_, note, I'm not starting any jobs from master-job (like the cookbook example did with script section) | 14:20 |
zyga | jhunt_, because that made my master-job not an abstract job (so something I could no longer stop) | 14:20 |
jhunt_ | zyga: you can do what you are trying to do there, but have you specified "instance $INSTANCE"? | 14:21 |
zyga | yes | 14:23 |
zyga | w8 | 14:23 |
zyga | (thunderstorm, flooding workplace) | 14:23 |
zyga | http://paste.ubuntu.com/745154/ | 14:25 |
zyga | http://paste.ubuntu.com/745155/ | 14:25 |
zyga | jhunt_, ^^ | 14:25 |
zyga | jhunt_, I'm somewhat unsure on how variable expansion happens in upstart | 14:25 |
jhunt_ | zyga: you don't have any "start on" so that job will only start if you run "start <job>". | 14:26 |
zyga | the problem is with uwsgi worker job | 14:27 |
zyga | there is another task that starts lava-instance | 14:27 |
zyga | and that works | 14:27 |
zyga | start on starting lava-instance INSTANCE=$INSTANCE | 14:27 |
zyga | this line, from the latter pastebin, seems not to work | 14:27 |
zyga | essentially I want to say "when lava-instance with the same instance identifier as myself is starting, start me" | 14:28 |
jhunt_ | zyga: I think you might be missing an "export INSTANCE" in lava-instance.conf | 14:29 |
zyga | oh, | 14:29 |
zyga | let me see, that would make sense | 14:29 |
zyga | jhunt_, I added "export INSTANCE" to lava-instance.conf | 14:31 |
zyga | jhunt_, it did not work (the lava-instance-uwsgi task never started) | 14:32 |
zyga | do I need to say env INSTANCE=$INSTANCE | 14:32 |
zyga | and then export INSTANCE? | 14:32 |
zyga | and does the order of declarations matter? | 14:32 |
jhunt_ | zyga: the order nominally does not matter (unless you specify the same stanza twice, in which case the last instance "wins"). | 14:35 |
jhunt_ | zyga: ah - I think the problem is that you are setting INSTANCE, but that is one of Upstarts variables (http://upstart.ubuntu.com/cookbook/#standard-environment-variables). | 14:36 |
jhunt_ | You should be doing something like "instance $FOO" such that INSTANCE will automatically be set to the value of $FOO. | 14:36 |
zyga | ah | 14:40 |
zyga | thanks, let me see how that works then | 14:41 |
zyga | now to think of a good alternative to INSTANCE | 14:41 |
zyga | still nothing | 14:43 |
zyga | let me give you all the upstart files I have | 14:43 |
zyga | root@limpy:/etc/init# pastebinit /etc/init/lava.conf | 14:48 |
zyga | http://paste.ubuntu.com/745162/ | 14:48 |
zyga | root@limpy:/etc/init# pastebinit /etc/init/lava-instances.conf | 14:48 |
zyga | http://paste.ubuntu.com/745163/ | 14:48 |
zyga | root@limpy:/etc/init# pastebinit /etc/init/lava-instance.conf | 14:48 |
zyga | http://paste.ubuntu.com/745164/ | 14:48 |
zyga | root@limpy:/etc/init# pastebinit /etc/init/lava-instance-uwsgi.conf | 14:48 |
zyga | http://paste.ubuntu.com/745165/ | 14:48 |
zyga | jhunt_, the syslog output of 'start lava' is: | 14:48 |
zyga | Nov 21 15:43:16 limpy logger: LAVA instance (lava) starting... | 14:48 |
zyga | Nov 21 15:43:16 limpy logger: LAVA instance (lava) started | 14:48 |
zyga | Nov 21 15:43:16 limpy logger: Staring LAVA (all instances) | 14:48 |
zyga | so it never touched the lava-instance-uwsgi.conf job | 14:49 |
zyga | jhunt_, any ideas? | 14:55 |
zyga | jhunt_, I managed to resolve the problem | 15:13 |
SpamapS | zyga: start on starting lava-instance LAVA_INSTANCE=$LAVA_INSTANCE ... | 16:32 |
SpamapS | zyga: that can't match, because $LAVA_INSTANCE == "" at that point | 16:32 |
SpamapS | zyga: I think what you want is just start on starting lava-instance | 16:33 |
SpamapS | zyga: then $LAVA_INSTANCE will be picked up because of the export LAVA_INSTANCE in lava-instance.conf | 16:33 |
zyga | roght | 16:38 |
zyga | right | 16:38 |
zyga | that's what I did | 16:39 |
zyga | now it works | 16:39 |
zyga | I have not tested it with multiple instances (still hacking other parts of lava) | 16:39 |
zyga | but that works now | 16:39 |
zyga | SpamapS, so you are correct | 16:39 |
zyga | :-) | 16:39 |
zyga | lava will have about 10 jobs total | 16:39 |
zyga | it could be nice example on how to use various parts of upstart | 16:39 |
zyga | btw, I think I found a bug, have not investigated deeper yet but "env PATH=/srv/lava/bin:$PATH" makes upstart reject the job somehow | 16:40 |
Generated by irclog2html.py 2.7 by Marius Gedminas - find it at mg.pov.lt!