/srv/irclogs.ubuntu.com/2011/11/21/#upstart.txt

=== jY- is now known as jY
zygahi12:56
zygaI need to shut down uwsgi server from upstart, the problem is that the server expects SIGQUIT, not SIGTERM12:56
zygaI have not found a way to configure the signal sent by upstart so I'm trying to achieve the same with pre-stop script12:57
zygahow can I know the PID of the main task from the pre-stop script?12:57
zygajhunt_, ping13:00
zygajhunt_, ping14:18
jhunt_zyga: hi14:18
zygajhunt_, can I have one job say "start on starting master-job INSTANCE=$INSTANCE"14:18
zygajhunt_, I have instances everywhere14:18
zygajhunt_, I wanted to have one master job per instance14:19
jhunt_zyga: have you seen http://upstart.ubuntu.com/cookbook/#instance ?14:19
zygajhunt_, then a few actual jobs with daemons/processes that do particular aspect of that instance14:19
zygajhunt_, I read the cookbook (still staring at it)14:19
zygajhunt_, it just that it does not work in practice when I try14:19
zygajhunt_, note, I'm not starting any jobs from master-job (like the cookbook example did with script section)14:20
zygajhunt_, 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
zygayes14:23
zygaw814:23
zyga(thunderstorm, flooding workplace)14:23
zygahttp://paste.ubuntu.com/745154/14:25
zygahttp://paste.ubuntu.com/745155/14:25
zygajhunt_, ^^14:25
zygajhunt_, I'm somewhat unsure on how variable expansion happens in upstart14:25
jhunt_zyga: you don't have any "start on" so that job will only start if you run "start <job>".14:26
zygathe problem is with uwsgi worker job14:27
zygathere is another task that starts lava-instance14:27
zygaand that works14:27
zygastart on starting lava-instance INSTANCE=$INSTANCE14:27
zygathis line, from the latter pastebin, seems not to work14:27
zygaessentially 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.conf14:29
zygaoh, 14:29
zygalet me see, that would make sense14:29
zygajhunt_, I added "export INSTANCE" to lava-instance.conf14:31
zygajhunt_, it did not work (the lava-instance-uwsgi task never started)14:32
zygado I need to say env INSTANCE=$INSTANCE14:32
zygaand then export INSTANCE?14:32
zygaand 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
zygaah14:40
zygathanks, let me see how that works then14:41
zyganow to think of a good alternative to INSTANCE14:41
zygastill nothing14:43
zygalet me give you all the upstart files I have14:43
zygaroot@limpy:/etc/init# pastebinit /etc/init/lava.conf14:48
zygahttp://paste.ubuntu.com/745162/14:48
zygaroot@limpy:/etc/init# pastebinit /etc/init/lava-instances.conf14:48
zygahttp://paste.ubuntu.com/745163/14:48
zygaroot@limpy:/etc/init# pastebinit /etc/init/lava-instance.conf 14:48
zygahttp://paste.ubuntu.com/745164/14:48
zygaroot@limpy:/etc/init# pastebinit /etc/init/lava-instance-uwsgi.conf 14:48
zygahttp://paste.ubuntu.com/745165/14:48
zygajhunt_, the syslog output of 'start lava' is:14:48
zygaNov 21 15:43:16 limpy logger: LAVA instance (lava) starting...14:48
zygaNov 21 15:43:16 limpy logger: LAVA instance (lava) started14:48
zygaNov 21 15:43:16 limpy logger: Staring LAVA (all instances)14:48
zygaso it never touched the lava-instance-uwsgi.conf job14:49
zygajhunt_, any ideas?14:55
zygajhunt_, I managed to resolve the problem15:13
SpamapSzyga: start on starting lava-instance LAVA_INSTANCE=$LAVA_INSTANCE ...16:32
SpamapSzyga: that can't match, because $LAVA_INSTANCE == "" at that point16:32
SpamapSzyga: I think what you want is just start on starting lava-instance16:33
SpamapSzyga: then $LAVA_INSTANCE will be picked up because of the export LAVA_INSTANCE in lava-instance.conf16:33
zygaroght16:38
zygaright16:38
zygathat's what I did16:39
zyganow it works16:39
zygaI have not tested it with multiple instances (still hacking other parts of lava)16:39
zygabut that works now16:39
zygaSpamapS, so you are correct16:39
zyga:-)16:39
zygalava will have about 10 jobs total16:39
zygait could be nice example on how to use various parts of upstart16:39
zygabtw, I think I found a bug, have not investigated deeper yet but "env PATH=/srv/lava/bin:$PATH" makes upstart reject the job somehow16:40

Generated by irclog2html.py 2.7 by Marius Gedminas - find it at mg.pov.lt!