/srv/irclogs.ubuntu.com/2013/03/09/#upstart.txt

tartarI have a pair of conf files, one for a service SERVICE.conf and another for a task blocking its dependants from starting earlier, SERVICE-block-dependants.conf.00:40
tartarHow do I block the pre-start of SERVICE.conf until mounted MOUNTPOINT=/ ?00:41
tartarCurrently I wait for a writeable directory the service needs in its pre-start and absence of *fsck* processes.00:43
tartarThis worked around the scenario when the dependants start early in /sbin/init, running "start SERVICE".  At that point / still mounts in memory and an mountall runs fsck for the root disk partition.  That fsck process may take a minute or more on exceeding the maximum count.00:46
tartar    while ! test -w /var || killall -0 --regexp fsck ; do00:47
tartar         sleep 100:47
tartar     done > /dev/null 2>&100:47
tartarBut this still suffers from a timing window between the exit of fsck and the mount of /.00:48
tartarI would rather depend on "mounted MOUNTPOINT=/", but I find difficult to inject this hook into the pair.00:50
tartarIt does not matter how long fsck runs, the timing window would present the same probability for SERVICE to use the fake /var.00:52
tartarIf that happens, mountall's mounting / against the real disk partition causes the loss of file entries the service created in the fake /var.00:53
tartarI could use the output of "df /var" to tell if /var belongs in a disk, but this does not look as nice as "mounted MOUNTPOINT=/".01:04
tartarIt would be nice if I could use a conjunction "and" against a set of "or" hook events in SERVICE-block-dependants.conf, but I heard this suffered from a bug and I am stuck with Lucid for now.01:07
tartarUsing "and" in SERVICE-block-dependants.conf would mix up the existing hook events for SERVICE's dependants with the new hook event for SERVICE's requisite.  This would complicate reasoning for the SERVICE-block-dependants.conf.01:11
tartar 01:15
tartarTo sum up, I need to wait for a hook or pass if the hook already went by.01:16
tartarCan initctl do that?01:16
tartarAlternatively, I would love to "initctl emit wait-for-mountall MOUNTPOINT=/" if mountall could receive upstart events.01:24
tartarI guess some mountall-watch.conf could "start on wait-for-mountall MOUNTPOINT=/ and mounted MOUNTPOINT=/"?  Will Lucid's upstart wait for 2 hook events in any succession before returning control to the above "initctl emit"?01:33
tartarI do not need MOUNTPOINT=/ in wait-for-mountall.01:35
tartarTo shorten that, I do not need to send a hook, I could just "start on starting SERVICE and mounted MOUNTPOINT=/" in some root-block-SERVICE.conf.01:41
keshav89Hello everyone05:07
keshav89I am a newbee in upstart05:07
keshav89Just got to know about upstart05:07
keshav89as I was searching for a process management tool05:07
keshav89Requirement was running my flask app forever05:08
keshav89Basically I have ubuntu VM to which I ssh and run my "python flaskapp.py" - which starts a dev server05:08
keshav89but if ssh connection breaks that server comes down05:09
keshav89came to know about gunicorn and then upstart 05:09
keshav89read the doc of upstart a bit05:09
keshav89Here is what I understand:05:10
keshav891. I need to write one simple myflask.conf05:10
keshav892. Plcae it under /etc/init/05:10
keshav89*Place05:10
keshav893. in that script I will write something like : "pre-script chdir <flask_dir> end script exec python flaskapp.py"05:12
keshav89Am I correct?05:12
keshav89with script i meant myflask.conf which will be placed under /etc/init/05:12
keshav89Any help or assistance appreciated05:13
keshav89oh I should also have this line in the .conf file : "start on startup" right?05:17
keshav89anybody?05:31
keshav89:-[05:32
keshav89I have a small conf file under /etc/init/11:59
keshav89Which I am trying to run11:59
keshav89with initctl11:59
keshav89start on startup12:00
keshav89pre-start script12:00
keshav89# Changing directory to flask app12:00
keshav89   chdir /usr/src/test/ans/12:00
keshav89end script12:00
keshav89script12:00
keshav89   gunicorn -b 0.0.0.0:1234 testflask:app12:00
keshav89   console output12:00
keshav89end script12:00
keshav89Basically I am trying to keep flask server running12:00
keshav89Am I doing something wrong?12:01
keshav89I am trying initctl start myflask.conf12:01
keshav89Anyone?12:16
keshav89http://paste.ubuntu.com/5598674/12:33
xnoxtartar: http://upstart.ubuntu.com/cookbook/ see "how to block another job"13:38
xnoxyou can create a job which will block your main one, until complete. I think that will work for you.13:38
xnoxkeshav89: http://upstart.ubuntu.com/cookbook/#chdir stanza?13:39
jamescarrSpamapS: this is a shot in the dark, but your name came up when I was frantically googling for libmysqlclient-dev help on ubuntu :)17:58
jamescarrSpamapS: do you know where I might find one of the maintainers on irc? Or at least someone familiar with it?17:58
jamescarrSpamapS: never mind, I see you're one of them18:15
=== phroddon_ is now known as phroddon
SpamapSjamescarr: I'm a maintainer yes. Want to chat in #ubuntu-devel ?19:05
jamescarrsure19:05
preyaloneI like to start little web servers on boot. I've been using upstart, but often my scripts fail, causing important services like sshd to fail to start. What's a safer way to do this?19:06
jamescarrpreyalone: I've never seen sshd not get started, are you fooling with the maintainer provided upstart scripts?19:08
preyalonejamescarr: I haven't fooled with anything. I recently upgraded my hardware (I use Gandi VPS hosting), and the sysadmin helping me with the upgrade mentioned that when my upstart scripts fail, it can cause things like sshd to not start up.19:10
SpamapSpreyalone: thats b.s.19:10
jamescarryah what SpamapS said19:11
preyaloneUnderstood.19:11
SpamapSpreyalone: can you share your upstart job that sometimes fail?19:11
jamescarrjust because an upstart script fail doesn't keep others from running19:11
SpamapSpreyalone: I'd bet that you're starting things too early19:11
preyaloneIn any case, I've noticed that my upstart scripts DO fail a lot, so when my server restarts, I'll notice that a service isn't running at all. Example: https://github.com/mcandre/node-ios7crypt/blob/master/upstart.conf19:11
SpamapSjamescarr: well, a failing job could certainly have also somehow cancelled another one. But.. yeah19:11
SpamapSyep19:12
SpamapSpreyalone: man upstart-events19:12
SpamapSpreyalone: startup is *WAY* too early19:12
SpamapSpreyalone: no network, no disks, nothing19:12
SpamapSpreyalone: its only by a miracle that 'start on startup' ever works.19:12
SpamapSpreyalone: you want 'start on runlevel [2345]'19:12
preyaloneSpamapS: Thanks. :P19:12
SpamapSpreyalone: also, 'shutdown' is not an event. So you want 'stop on runlevel [016]'19:13
SpamapSman19:13
SpamapSthere are a few examples that use those two events19:13
SpamapSand they are like *weeds*19:13
SpamapSkill 1, 5 more pop up19:13
preyaloneCan upstart scripts use hard tabs, soft, or what?19:16
SpamapSpreyalone: doesn't matter19:18
SpamapSpreyalone: they are not whitespace sensitive19:18
preyaloneIs that standard for .conf files, or just upstart .conf files?19:18
SpamapSupstart19:23
SpamapS.conf means nothing19:23
SpamapS/etc/init/*.conf == upstart19:24
preyaloneSpamapS: Thanks for the info. I'm just thinking about configuring indentation in my text editor.19:31
preyaloneMy Rails app works when I start it manually. But when I try to call the same command via upstart, my server doesn't start up. https://github.com/mcandre/doesrailswork/blob/master/upstart.conf20:06
xnoxpreyalone: no need to use script, the exec and chdir are top level stanzas just like "start on"20:08
preyalonexnox: Thanks, but that doesn't alter the behavior.20:09
xnoxthere is no command line executable "chdir" so that's where the script fails.20:09
xnoxas the whole script is executed as if it's shell, with set -e20:10
preyalone"rails server" needs to be executed in a specific current directory. What's the best way to do this in upstart?20:12
preyalonexnox: I tried moving chdir and exec outside of script, but the problem still exists: the Rails app isn't running after I do "sudo start doesrailswork".20:19

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