/srv/irclogs.ubuntu.com/2013/02/15/#upstart.txt

afournierhi! i am doing something like this "start on (postinsts-done or database-up DB=mydb)" is it possible to know which signal (postinsts-done or database-up) triggered the start ?10:27
xnoxafournier: well DB environment variable will be set in the later case.10:43
xnoxafournier: and in the former case UPSTART_EVENTS10:46
xnoxafournier: see http://upstart.ubuntu.com/cookbook/#standard-environment-variables10:46
afournierok10:46
xnoxafournier: just check upstart_events and see what it has in it.10:47
xnox(all caps)10:47
afournieryes10:47
afournierthanks xnox10:47
afournieri love upstart10:51
xnox=)10:52
=== doko_ is now known as doko
afournieri don't understand the shutdown / reboot process16:26
afournieri have a a bug in a job so a chain of process does not stop16:27
afournierbut then why upstart does not end up killing everything16:27
xnoxon ubuntu upstart does kill all processes it tracked16:53
xnoxif the pid of the job does not match the pid of processes it tracks upstart will not kill it16:54
xnoxlater /etc/init.d/sendsigs kills everything16:54
afournierso it means upstart does cannot track some of my jobs17:10
afourniercould be because of a wrong expect stanza...17:11
=== JanC_ is now known as JanC
xnoxyes18:57
tgm4883We've got an upstart job where occasionally the process doesn't respond to SIGTERM and continues to run. This for some reason allows multiple processes to start when starting the job again (like the upstart job lost track of the previous process). Is there something we can do with the upstart job (or something to troubleshoot) to see why it's allowing this? For reference, here is the upstart job  https://github.com/MythTV/packaging/blob/master/de20:13
tgm4883b/debian/mythtv-backend.upstart20:13
tgm4883https://github.com/MythTV/packaging/blob/master/deb/debian/mythtv-backend.upstart20:13
tgm4883hmm, reading thought the expect parts of the cookbook. This is probably what I need. Is there a way to see what PID(s) upstart is currently tracking for a job? 20:25
xnoxtgm4883: the mythtvbackend should be prepended with exec20:51
xnoxe.g. see /etc/init/hwclock.conf20:51
tgm4883xnox, and that will make it so upstart stops losing track of it?20:52
xnoxtgm4883: next please start it and check that the pid from $ status mythtv-backend matches pgrep mythbackend20:53
xnoxwhen only one mythbackend is running20:53
xnoxif they don't match then expect/fork stanza is not right20:54
xnoxif the pid is what you expect then20:54
xnoxwe shall wait for jodh to wake up tomorrow to poke at it a little more20:54
tgm4883xnox, what does the exec do?20:55
tgm4883looking at the status PID (without using exec), it's not right 20:56
xnoxhttp://upstart.ubuntu.com/cookbook/#exec20:56
xnoxtgm4883: yeah, you are probably tracking the pid of "test -f" call ;-020:57
tgm4883root      1738  0.0  0.0   4400   612 ?        Ss   Feb08   0:00 /bin/sh -e /proc/self/fd/920:57
tgm4883that is what it's tracking20:57
tgm4883actual PID is 174020:57
tgm4883I'm assuming because the upstart job calls a wrapper script20:57
tgm4883and that expect isn't right20:57
xnoxtgm4883: kill everything, add expect, start up compare the pids20:58
tgm4883xnox, can I just edit /etc/init/mythtv-backend.conf directly and restart?20:58
tgm4883xnox, or do I need to notify upstart that some changes happened20:59
xnoxtgm4883: no just edit and it will pick it up (it uses inotify)20:59
xnoxif you are on overlayfs then you could use: initctl reload-configuration20:59
xnoxto be sure.20:59
xnoxtgm4883: if the pids are still 2 digits apart you need expect daemon20:59
xnoxif one, than it's a fork21:00
xnoxexpect fork21:00
tgm4883with exec, looks like it's tracking the right PID21:01
tgm4883with using expect at all21:01
xnoxif the pids are correct21:01
xnoxthan it all should just work ;-)21:01
tgm4883:)21:01
tgm4883xnox, have time for one more question?21:01
xnoxand sigterm is now send to the correct process =)21:01
xnoxtgm4883: go on.21:02
tgm4883xnox, does upstart allow for conditional "start-on" yet? eg. we'd like to do "start on mysql started" but only if mysql is installed21:02
tgm4883I know it was on the roadmap at one point, but I haven't heard anything about it21:03
xnoxstart on mysql or (other)21:05
xnoxin pre-start:21:05
xnoxcheck for status mysql and if job is unknown continue, if known and not started yet abort starting just yet.21:06
tgm4883ok, so we can do that in the pre-start script?21:08
tgm4883sorry, trying to find this in the cookbook21:08
xnoxstart on mysql or (other-events)21:10
xnoxpre-start script21:10
xnox! status mysql || { stop; exit 0; }21:10
xnoxend script21:10
xnoxstart on started mysql or (other-events) that is21:10
tgm4883ok, and that will still work even if mysql isn't installed? 21:15
tgm4883I misunderstood the cookbook then21:15
tgm4883(or it changed since we first made the upstart job)21:15
SpamapStgm4883: start on started mysql will not give any errors22:44
SpamapStgm4883: if nothing ever emits 'started mysql' ...22:44
SpamapStgm4883: then the job never starts22:44
tgm4883SpamapS, well that's not really what we want22:51
tgm4883SpamapS, we'd like to start on mysql started, but account for instances where mysql isn't installed (eg. it's installed on another machine)22:52
SpamapStgm4883: hang on...22:59
SpamapStgm4883: how is upstart supposed to know about other hosts?23:06
tgm4883SpamapS, it's not. It's just suppose to assume that "If mysql is install, wait for mysql to start. Otherwise continue starting on other deps"23:06
SpamapStgm4883: if you can handle that case in your app, just start whenever23:07
SpamapSno guarantees the other host will be up ever23:07
tgm4883SpamapS, it's not my app. we just package it23:07
tgm4883SpamapS, I'm just trying to make this the easiest on users without causing loads of work for them to do23:08
SpamapStgm4883: perhaps your pre-start should spin polling for the mysql server23:11
tgm4883SpamapS, currently it does. We look for /usr/sbin/mysqld23:12
tgm4883SpamapS, but that is a really crappy way to do it23:12
SpamapSno no no23:12
SpamapSthe port23:12
SpamapSwherever it is23:12
SpamapSwhile ! mysqladmin ping ...23:13

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