/srv/irclogs.ubuntu.com/2010/03/18/#upstart.txt

=== rberger_ is now known as rberger
bottigerI've tried to manage my upstart services with both "rcconf" and "bum" to make some services start (or not start) automatically. However, it simply does not work. If I disable "mysql" it shows up as disables in both rcconf and bum, but it still starts up when I boot09:53
bottigerany idea what the problem could be09:54
sadmac2bottiger: that's more of a debian/ubuntu question13:12
donEduardohi there.15:41
donEduardois this the correct group for upstart in ubuntu?15:41
donEduardoor is this group rather general?15:41
Keybukthis is the general group for the different distribution maintainers developing upstart15:42
Keybukif you're having ubuntu problems, you should ask in #ubuntu15:42
donEduardoif got an upstart problem in ubuntu 10.04 alpha... ok, i'll try at #ubuntu15:47
donEduardos/if/i've15:47
=== elpargo_ is now known as elpargo
Ngso process supervision :)20:03
Ngis there any way for upstart to indicate that something has been respawned other than its syslog entries?20:03
Ng(I'm thinking that as a sysadmin I'd want realtime alerts that $IMPORTANTDAEMON has died and been restarted, ideally not by having to do realtime syslog analysis)20:04
sadmacNg: you could detect the starting event from another job and have that fire off whatever20:09
Ngoh interesting20:10
Ngoh the starting event, not a specific respawning event?20:17
Ngactually what I'd care about is the *dying* of a process, but that's implied by it having been restarted ;)20:18
sadmacNg: I think you get a stopping event too20:19
sadmacthere's no respawning event though20:19
sadmacyou definitely don't get a stopped event when respawning. it doesn't make it all the way down.20:19
Ngit might be a little annoying if booting a machine triggered a bunch of alerts ;)20:20
=== elpargo_ is now known as elpargo
=== elpargo_ is now known as elpargo
wasabi`script` stanza could use an extension:21:45
wasabiscript /bin/bash21:46
wasabi\tfoo21:46
wasabiend script21:46
Keybukbut then we don't know whether what you give supports /proc/self/fd21:46
Keybukand we don't know whether it supports "-e"21:46
wasabiTrue.21:46
Keybukwe don't know whether it supports being able to give single commands with "-c"21:47
wasabiI'd probably just say: yeah. if it support -e, you have to add it21:47
KeybukI like the fact that script -es by default21:47
Keybukscript sh21:47
Keybuk ...21:47
Keybukend script21:47
Keybukwould bypass that21:47
Keybukand be remarkably inconsistent21:47
wasabithat is true. 21:47
wasabiwell, you see where I'm going.21:48
wasabiscript python21:48
wasabiblah21:48
wasabiI'd probably just say adopt the same semantics any +x file has21:48
sadmacKeybuk: what if we allowed you to pipe part of the job definition to the exec stanza's argument?21:54
sadmacexec python <<<END21:54
sadmacimport foo21:54
sadmacmain()21:54
sadmacEND21:54
wasabiThat looks weird.21:54
wasabiIt might be an argument for not using 'script', but instead extending 'exec' into a block stanza./21:55
wasabiwith script being locked to sh -e21:55
wasabis21:55
sadmacwasabi: it does, but it skirts most of Keybuk's arguments semantically. I'm in the habit of doing this. Eventually it results in Really Cool Things.21:55
wasabiexec python21:55
wasabi  import foo21:55
wasabi  main()21:55
wasabiend exec21:55
wasabiSince exec is already defined as not passing any arguments.21:56
wasabiI think it might be more appropiate too21:56
sadmacthat makes the grammar ambiguous if you keep the one-liner exec21:56
wasabias 'script' might not always even be the right name for it.21:56
Keybuksadmac: I'm just wondering to myself what that exec line would do now ;-)21:56
Keybuksince technically exec is just a shortcut for21:56
Keybukscript21:56
Keybuk  exec ...21:56
Keybukend script21:56
Keybuk;-)21:56
wasabiHeh21:56
wasabiwhat about a utility that reads from stdin to process commands... that you want executed every now and then21:57
wasabibut it's clearly not a scripting language21:57
sadmacKeybuk: it would do the same as always, but make stdin a pipe first, then it'd write the python script into it21:57
wasabishit, nc21:57
wasabiexec nc host21:57
wasabi\tstuff21:57
wasabiend exec21:57
Keybukright21:57
Keybukthere's three different types of program21:57
Keybuk1) those that take commands on command-line, e.g. sh -c "foo;bar;baz"21:58
sadmacwasabi: I spent a week in my security class trying to find ways to trick users into doing that. Making it easier to do voluntarily seems wrong21:58
Keybuk2) those that take a script filename on command-line, e.g. sh /foo/bar.sh21:58
wasabiheh21:58
wasabisendmail then. :)21:58
Keybuk3) those that take commands on standard input21:58
wasabiexec sendmail admin@isillc.com21:58
wasabi  shit's busted21:58
wasabiend exec21:58
sadmacKeybuk: shock moment, what if we just supported shebang lines21:58
sadmacscript21:58
sadmac#! /bin/python21:58
sadmacetc21:58
sadmacend script21:58
wasabiheh.21:58
Keybuksadmac: no way to execute that ;-)21:59
Keybukchmod +x /proc/self/fd/421:59
Keybukdoesn't quite work21:59
wasabiWhat about symbols in front of the cmd name to specify how the body is passed to it?21:59
Keybuksymbols would be ick21:59
sadmacwhat does the command have to do to supprt /proc/self/fd?21:59
Keybukbut I like the idea that you should be able to run things with stdin21:59
wasabimaybe. but there's um21:59
wasabiwhat's the word for it21:59
KeybukI already want to be able to run things and capture stdout after all21:59
wasabicrap. brain dead.21:59
Keybuksadmac: to do #! you need a filename22:00
wasabiexec - sendmail jhaltom@isillc.com22:00
wasabi foo22:00
wasabiend exec22:00
wasabithat gets passed to stdin22:00
wasabi(making stuff up)22:00
Keybukwhy not perlish?22:00
wasabibecause i don't know perl.22:00
Keybukexec |sendmail jhaltom@isillc.com22:00
wasabiheh22:00
wasabiThat's sort ofe stablished elsewhere too22:00
wasabi/etc/aliases22:00
sadmacKeybuk: same reason we couldn't do22:00
sadmacscript /bin/python22:01
sadmacend script22:01
sadmacthen22:01
Keybukone sec, changing machines22:01
sadmacah, wing-commander. I missed that box22:02
wasabiexec >sendmail jhaltom@isillc.com22:02
wasabior | I guess22:02
wasabiGot me22:02
Keybuksadmac: lol, "missed it" ?22:02
wasabiI don't like symbols like that.22:02
sadmacKeybuk: there's a lot you don't know that happened between me and your computer.22:02
sadmacKeybuk: don't judge us. we were young. we did what felt right.22:03
Keybukshould I dunk my laptop in bleach?22:03
sadmacKeybuk: yes. and you might want to get a new refridgerator.22:04
Keybuksyntax aside for a moment22:04
Keybukwhat magic input/output/commandline things should we support here?22:04
sadmacstdin makes sense22:05
sadmacwhatever the most standard syntax is, it should work by the same mechanism as #!, that is if an interpreter works in a #! line it should work in a job definition with minimal effort22:05
Keybukright #! is "append filename to the #! line"22:06
Keybukwhich should mean we can append /proc/self/fd/N22:06
sadmacreally. thought it was pipe-through22:06
Keybukno, cause you can do22:06
Keybukecho "#!/usr/bin/sendmail" > casey.dahlin@redhat.com22:06
Keybukchmod +x !$22:06
sadmacyeah, you're right22:06
Keybuk./casey.dahlin@redhat.com22:06
KeybukSubject: foo22:06
Keybuketc.22:06
wasabistdin and last argument make sense to me.22:06
wasabianything else can be done by hand22:07
wasabiexec /proc/fd/022:07
wasabiexec foo --name=/proc/fd/0 anyways22:07
KeybukI also want to support capture-standard-output22:07
wasabisame.22:07
Keybukfor programs that write FOO=bar as standard output22:07
wasabiWhere would you send it, though? :)22:07
Keybukit'd be part of the job's environment22:07
sadmacKeybuk: that's always felt a bit special to me22:07
wasabiHmm.22:07
Keybuksadmac: it's used by just about everything "agent-esque"22:08
Keybukdbus downards22:08
wasabiYeah. That would be much nicer.22:08
wasabiSimply scrape the env exported by dbus when launching a dbus service22:08
wasabino work done.22:08
wasabiexcept to export it in dbus22:08
wasabiand make sure your job somehow fires with that env.22:08
Keybukright, dbus-daemon writes its session address and stuff to stdout22:08
sadmacKeybuk: I like a more general solution22:08
Keybukso any job with "while dbus-daemon" would have that in its environment22:09
wasabiYeah. That's rad. 22:09
sadmacexec dbus-session-bus | xargs upstart-set22:09
Keybukxargs? :)22:09
KeybukI guess22:09
Keybukthen I have to care about process groups22:10
sadmacyeah, the forking is a bit funny around that22:10
Keybukwe do need some kind of initctl to set environment though22:12
wasabiI'm fine with parsing name=value pairs.22:12
wasabithat's super standard.22:12
wasabiIt would be better in some way if you could have dbus communicate in another way that didn't involve any parsing22:13
Keybuklots of people seem to try and parse things in pre-start then punt to exec22:13
Keybukbut I think that's partly because exec sucks and you can't use cat if you're using fork-following22:13
sadmacKeybuk: look at augeas any? speaking of parsing.22:14
Keybuksadmac: no, not yet22:14
Keybukbut I have now sent all my patches to halfline, so I suck less, so can look at that in a bit22:14
sadmaccool22:14
Keybukthe good news is we found a major bug with pre-stop in upstart ;)22:15
Keybuk(as a result of plymouth issues)22:15
sadmacI'm figuring this JSON stuff we've been discussing will need a parser anyway, so I'm going to complete nih-parse either way22:15
Keybuknot crasher - as in "clearly this approach is insane"22:15
sadmacah, cool22:15
Keybukand pre-stop was the only thing stopping me from getting rid of all four scripts22:15
Keybukso now I can get rid of all four scripts and be happy22:15
sadmacKeybuk: so we have just one job now?22:16
wasabiJSON stuff22:16
wasabiSo, JSON parsing will be in upstart.22:16
wasabiSo it's hardly surprising that name=value parsing is22:16
sadmacwasabi: yeah, talking about using it for cross-upgrade stuff22:16
Keybukjust one process per job22:16
Keybukso job and process become the same thing22:16
sadmacname=value is hardly even parsing. Its regular for chrissake.22:16
wasabiYeah22:17
Keybukbut multiple jobs/processes defined in one conf file22:17
Keybukgiven what we talked about the other day:22:17
Keybuk  on foo22:17
Keybuk  exec ...22:17
Keybukit doesn't seem unreasonable to have a kinda "on self"22:17
Keybuk  on self starting22:17
Keybuk  exec ...22:17
Keybukthat's a task as we chatted about22:17
Keybukso that's basically identical to the current pre-start script22:17
sadmacKeybuk: where do names come from then?22:17
Keybuksadmac: names?22:17
sadmacKeybuk: yes, names for jobs22:18
Keybukright, so then i got thinking well22:18
sadmacKeybuk: they come from file names now22:18
Keybuk  pre-start exec ...22:18
Keybukthat's a named process called "pre-start"22:18
Keybuk  reload exec ...22:18
wasabiOh. Odd.22:18
Keybukthose would fire automatically22:18
Keybukit's not "there" yet22:18
Keybuk(syntaxwise)22:18
Keybukbut I think it works process-wise22:18
sadmacso with the hierarchy thing we get all of it22:18
sadmacfoo exec whatever in a file called stuff.conf creates a stuff foo job22:19
sadmacwhich is a silly name, but real world examples would make sense22:19
Keybukright exactly22:19
sadmacwe can parse it, to be sure.22:20
* sadmac needs to finish up the parse tool22:21
sadmacmy code quality has been wildly inconsistent. I'm going to throw away what I'm writing, but then maybe I'll copy paste some of it. I can't decide if I give a shit whether it leaks memory or not.22:22
sadmacthe joys of writing a program who's first and only task is to rewrite itself :)22:22
Keybukll22:22
Keybuklol22:22
Keybukmemory's cheap these days22:23
Keybukthey can buy more22:23
sadmacthe good news is it won't need many tests. It tests itself just by being compiled :)22:23
sadmacKeybuk: that's not funny. Java people still say that with a straight face22:23
sadmacno wonder 2/3 the core dumps I get in during $dayjob report more memory than my hard disk.22:24
Keybukheh22:27
wasabitrying to do this: which is failing. not sure why.22:27
wasabiscript22:27
wasabi\t /bin/bash << EOF22:27
wasabibunch of crap. blah blah.22:28
wasabiEOF22:28
wasabiend script22:28
wasabiSeems to break when I add my first complicated line of script: l=( backup users profiles )22:28
wasabiCan't imagine why any of it would need to be escaped for any reason22:28
Keybuktwo shells?22:29
Keybukyou need to escape it from the first shell for the sceond to see it22:29
Keybukscript22:29
wasabish is reading from a file in proc, right?22:29
Keybuk  FOO=bar22:29
Keybuk  /bin/bash << EOF22:29
Keybuk  FOO=baz22:29
Keybuk  echo $FOO22:29
Keybuk  EOF22:29
Keybukend script22:29
Keybukwill echo bar not baz22:29
Keybukwasabi: yes22:29
wasabiI see.22:30
Keybukthe outer shell applies full expansion to everything22:30
Keybukeven the bits between << EOF and EOF22:30
wasabistill no worky though22:30
wasabi/bin/bash << EOF22:30
wasabiFOO=bar22:30
wasabiEOF22:30
wasabifails. returns 222:30
wasabi<< isn't like, not sh compatible, is it?22:31
Keybukit is afaik22:31
wasabiAhh.22:31
wasabiComments in the script body22:31
wasabieven unindented ones22:31
wasabinot sure why they're breaking it, but they are.22:31
wasabioh.22:32
Keybukcan't have comments in strings maybe?22:32
wasabithey're probably being expanded when they shouldn't?22:32
Keybukright22:32
wasabiwould have thought upstart would have removed them22:32
wasabiguess not22:32
Keybukwhy?22:32
Keybukupstart passes everything between script and end script22:32
wasabiincluding leading indents? k22:32
Keybukactually22:32
Keybukno ;)22:32
wasabiheh.22:32
wasabisee.22:32
Keybukit kinda de-dents everything22:32
wasabii knew it didn't do that22:32
wasabiso I assumed it realized that a non-indented line was an upstart command22:33
Keybukbut that's actually good for you22:33
Keybukcause22:33
Keybukexec sendmail22:33
Keybuk  blah22:33
Keybuk  blah22:33
wasabiand upstart would fail if it wasn't # or end script22:33
sadmacKeybuk: could be a slight problem if we allow different interpreters, including python22:33
Keybukend exec22:33
Keybukgets de-dented22:33
Keybukand22:33
Keybukexec python22:33
Keybuk  blah22:33
Keybuk    blah22:33
Keybuk  blah22:33
Keybukend exec22:33
Keybukgets de-dented too22:33
Keybuksadmac: it only removes the initial whitespace common to *all* lines22:33
Keybukso that comes out as22:33
wasabiI'd adopt python rules. Each line must be indeneted with the same amount and type of whitespace. :)22:33
Keybukblah22:33
Keybuk  blah22:33
Keybukblah22:33
wasabiAnd that is auto removed by one level.22:33
Keybukwasabi: that's what it does22:34
wasabiSo why is # being passed to the script22:34
sadmaccontext sensitive lexical languages make me cry22:34
Keybukwasabi: because it doesn't remove comments22:34
wasabiBut the comment is not indented.22:34
wasabiSo it should be invalid.22:34
wasabiAnd refuse to run the task22:34
Keybukwhy?22:35
wasabiOR it should remove it. :)22:35
Keybukneither22:35
wasabi<wasabi> I'd adopt python rules. Each line must be indeneted with the same amount and type of whitespace. :)22:35
wasabi<Keybuk> wasabi: that's what it does22:35
Keybukthe comment means your block is simply not de-dented22:35
wasabioh.22:35
wasabihah.22:35
Keybukit doesn't throw out your entire script because you used a space instead of a tab22:35
Keybukthat's just un-necessarily pedantic22:35
Keybukit just doesn't de-dent22:35
Keybukit finds the common prefix from each line that consists entirely of whitespace characters22:36
Keybukand removes that22:36
Keybukif all lines begin \t\t then that is removed22:36
Keybukif all lines begin " \t    " then that is removed22:36
Keybukif, as you've done there, one line isn't indented - then nothing is removed22:36
Keybukit probably doesn't need to screw with it at all ;-)22:36
wasabigotcha22:36
Keybukbut it does22:36
Keybukit makes debugging perttier22:36
wasabiTrying to remember what i have to escape in this script to script then22:37
sadmacis that french?22:37
wasabi$ becomes $$...22:37
Keybukno that's something else22:37
Keybuk$ becomes \$ in shell ;-)22:37
Keybuk$ -> $$ is make22:37
wasabiahh22:37
wasabiduh22:37
* sadmac remembers windows programming22:38
sadmacC:\\Windows\\System....22:38
sadmacor \\\\Shared\\Folder22:38
wasabiwindows programming is all I do22:38
wasabi@"C:\Windows\System"22:38
sadmacwasabi: I'm sorry :)22:39
wasabiFine with me.22:39
sadmacanyway, time to go eat.\22:39
wasabiI enjoy getting things done. :022:39
Keybukwasabi: didn't you end up at Google?22:39
sadmacwasabi: I don't have time to flame you. please pick this fight again later that we might finish it :)22:39
wasabiNo. Didn't take it.22:40
Keybukahh22:40
wasabiThey keep asking though.22:40
Keybukthey do that22:40
KeybukMountain View seems like such a long time ago!22:40
wasabiyeah, it does.22:40
wasabiI think about how much fun I had talking with people who knew what the hell I was talking about22:40
wasabioften22:41
Keybukheh22:42
KeybukUDS again in not-so-long22:42
wasabiI'm not remotely involved enough to get travel paid for, work is super busy (and has been for 2 years).22:42
wasabiI'd love to go though.22:42
wasabiCan't afford the out of the states trips though.22:43
Keybukyeah22:44
Keybukthis one's in the middle of NOWHERE22:44
wasabiI didn't make it to the Dallas one.22:44
wasabiBecause of work.22:44
wasabiI LIVE IN DALLAS22:44
Keybukheh, fail22:45
wasabiTotal.22:45
wasabiI saw desrt though. Made him come out and drink.22:45
wasabiWhich he did little of.22:45
wasabiAnd then left early.22:45
wasabiOh well.22:45
wasabidouble escaping this is becoming hard to think about22:46
Keybukwas he at Dallas?22:46
wasabiYeah22:46
KeybukUDS has got so big now22:46
wasabiDallas can be a great city too. I wanted to come and be the local guy showing everybody where to party.22:46
KeybukI don't think I went into the desktop room once22:46
wasabiBecause it's completely non-obvious where to go.22:46
wasabi\${n//-/--}22:47
wasabiHmmm22:47
wasabiHah. Got it.22:47
wasabi\${n//\\-/\\-\\-}22:47
=== Keybuk_ is now known as Keybuk
=== solj_ is now known as solj

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