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