#upstart 2007-05-07
<JohnFlux> Hey all
<JohnFlux> anybody free at uds?
#upstart 2007-05-08
<Jurrely> hello Md
<Jurrely> I was searching for a freenode staffer. I need help:)
<Keybuk> this is not a freenode staffer channel
* mode/#upstart [+o Keybuk]  by ChanServ
* Jurrely was kicked off #upstart by Keybuk (Keybuk)
* mode/#upstart [-o Keybuk]  by Keybuk
<Md> oops...
* Md checks again his configuration
<Keybuk> ;)
* mode/#upstart [+I Md!*@*]  by Md
* mode/#upstart [+I Md_!*@*]  by Md
<Md> oops, sorry
* mode/#upstart [-II Md_!*@* Md!*@*]  by Md
<JohnFlux> Hey all
<JohnFlux> what's scotts irc nick?
<Keybuk> Scott who?
<ion_> /who #upstart
<JohnFlux> I'm interested in adding upstart support to ksysguard
<JohnFlux> the kde task manager thing
<JohnFlux> so that it recognises services
<JohnFlux> I'm finding the ubuntu doesn't package libupstart though
<JohnFlux> which I would kinda need
<Keybuk> you could just talk to him directly about it, since he's in Seville too?
<JohnFlux> Keybuk sure
<JohnFlux> Keybuk just checking here first incase somebody knows
<AlexExtreme> Keybuk, out of curiousity, why does logd raise SIGSTOP once it's ready for use?
<Keybuk> see man logd
<AlexExtreme> oh, it helps to RTFM
<AlexExtreme> sorry
<Keybuk> it's so init knows logd is running
<AlexExtreme> yes
<AlexExtreme> thanks
* AlexExtreme is trying to figure out that logd bug (processes using it as their terminal die if it exits)
<Keybuk> knows it is listening, I should say
<Keybuk> sweet
<AlexExtreme> so, the process dies with SIGPIPE. that's as far as i've got ;)
<Keybuk> heh
<AlexExtreme> is there a way for init to stop the process from dying if it gets SIGPIPE?
<Keybuk> no
<AlexExtreme> that makes things a lot more difficult :p
<Keybuk> :D
<Keybuk> so they are dying with SIGPIPE?
<Keybuk> and upstart notices?
<AlexExtreme> yeah
<AlexExtreme> it starts, runs, as soon as i kill logd:
<AlexExtreme> food (stop) stopping
<AlexExtreme> food (stop) killed
<AlexExtreme> food (stop) post-stop
<AlexExtreme> food (stop) waiting
<AlexExtreme> start: food main process killed by PIPE signal
<Keybuk> ok
<Keybuk> (yay for massively improved initctl)
<AlexExtreme> :)
<AlexExtreme> oh well, i need to sleep. cya
<Keybuk> nite
#upstart 2007-05-10
<cwright> hi, I have a box that has been cleanly dist-upgraded from dapper->edgy->feisty, and I am having some issues with upstart
<cwright> I originally asked on #ubuntu, but was referred here
<cwright> anyway, when I run 'initctl list', i see all the events waiting, except none of the tty's are shown in the listing
<cwright> this is a problem because I am trying to add a 'svscan' file to the events.d directory, but it does not start upon boot
<cwright> any suggestions?   I can provide more information if that would be helpful
<cwright> anyone here who can help with upstart issue?
<AlexExtreme> i might be able to help, but can you give me 10 minutes :) my dinner is ready
<AlexExtreme> brb
<cwright> heh sure thing :)
<AlexExtreme> back
<AlexExtreme> cwright, what did you want to ask? :)
<cwright> hi AlexExtreme, hope you enjoyed your dinner :)   
<AlexExtreme> i did, thanks :p
<cwright> I posted my question in here yesterday, but got no responses, I'll paste what I wrote again
<cwright> I have a box that has been cleanly dist-upgraded from dapper->edgy->feisty, and I am having some issues with upstart
<cwright> when I run 'initctl list', i see all the events waiting, except none of the tty's are shown in the listing
<cwright> this is a problem because I am trying to add a 'svscan' file to the events.d directory, but it does not start upon boot
<AlexExtreme> hmm....
<cwright> also, none of the tty's are started
<AlexExtreme> are you using a custom kernel?
<cwright> no, straight feisty server kernel
<AlexExtreme> hang on
<AlexExtreme> let me check my feisty install
<cwright> ok
<AlexExtreme> do the tty job files physically exist in /etc/event.d?
<cwright> yup
<cwright> here is what I see with initctl list:
<cwright> /etc/event.d# initctl list
<cwright> control-alt-delete (stop) waiting
<cwright> logd (stop) waiting
<cwright> rc-default (stop) waiting
<cwright> rc0 (stop) waiting
<cwright> rc1 (stop) waiting
<cwright> rc2 (stop) waiting
<cwright> rc3 (stop) waiting
<cwright> rc4 (stop) waiting
<cwright> rc5 (stop) waiting
<cwright> rc6 (stop) waiting
<cwright> rcS (stop) waiting
<cwright> rcS-sulogin (stop) waiting
<cwright> sulogin (stop) waiting
<AlexExtreme> could you pastebin the content of one of the tty files? (http://rafb.net/paste)
<cwright> svscan (start) running, process 4224
<cwright> I manually started svscan with 'initctl start svscan', at boot nothing starts, they all go into waiting
<cwright> sure, one sec
<AlexExtreme> and don't paste large amounts of text in here
<AlexExtreme> :)
<cwright> i am curious if it has to do with the dist-upgrade from edgy to feisty
<cwright> http://rafb.net/p/OS2sbu29.html
<AlexExtreme> yes, there's a syntax error in those files
<cwright> what is it?
<AlexExtreme> remove all the tty files in /etc/event.d, uninstall the system-services package and reinstall it
<AlexExtreme> it *should* recreate those files
<cwright> ok, this is a live box, is that going to affect anything running?
<AlexExtreme> shouldn't do
<cwright> i understand init intimately, upstart not so much :)
<AlexExtreme> :)
<cwright> ok, let me uninstall and reinstall real quick
<cwright> this is what I am seeing: http://rafb.net/p/JpewkK75.html\
<cwright> err, no slash on there
<cwright> is that safe to continue with?
<AlexExtreme> mmm no
<AlexExtreme> just aptitude install it rather than uninstalling first
<cwright> ok
<cwright> did that, no new tty files in /etc/event.d/  though
<AlexExtreme> hrm
<AlexExtreme> hang on
<cwright> can you pastebin your tty files and I can just replace mine?
<cwright> that would be good enough, i just need to get this to work
<AlexExtreme> hold on, i'm uploading an archive containing mine
<AlexExtreme> cwright, http://www.alex-smith.me.uk/files/ttys.tbz2
<AlexExtreme> just get that file, cd /etc/event.d, tar -xvjf /path/to/ttys.tbz2
<cwright> got it, thanks a bunch, let me try this out
<cwright> AlexExtreme: i really appreciate your help, after looking at the files closer i see the syntax error, should have caught that before
<cwright> i'm digging upstart, i much prefer it now
<AlexExtreme> yes, i'm going to assume that those errors were caused by a bug in the migrate-inittab.pl script
<AlexExtreme> i'll tell Keybuk about it later
<AlexExtreme> so, it's working now?
<cwright> well, i was able to start tty1, and i am rebooting the box now to see if svscan starts at boot as it should
<cwright> i should be able to tell you in a few minutes
<AlexExtreme> k
<cwright> yup, works great!   
<cwright> the box started, all ttys, and svscan
<cwright> so you are probably right about the bug.  these were clean dapper installs, migrated to edgy, and feisty all in a matter of about 30 minutes
<cwright> ok, well, that's all i needed help with.  thanks again AlexExtreme 
<AlexExtreme> no problem
#upstart 2008-05-05
<ion_> Note to self: mention to Keybuk:
<ion_> http://www.netsplit.com/2008/04/27/upstart-05-events/ âinstance TTYâ
<ion_> http://www.netsplit.com/2008/04/12/upstart-05-job-lifecycle/ âANdâ
<soul9> hi all
<soul9> can i query what services are running somehow?
<soul9> ok, got it
<soul9> oh, initctl list is not what i'm looking for
<soul9> it doezsn't list dbus, etc.
<soul9> doesn't
<ion_> soul9: As long as youâre using Upstart just to start the old sysvrc scripts, Upstart doesnât know about services started by said scripts. As soon as theyâre converted to actual Upstart jobs, Upstart will know about them.
<soul9> ok, so the old sysvrc didn't know how to list the running jobs, right?
<ion_> Yeah
<ion_> It has no concept of something that is still running after the init script exits.
<soul9> on hardy, though, i need to make a script that get run after an internet connection is established. is upstart a good place to look for?
<ion_> /etc/network/if-up.d
<soul9> oh
<soul9> thank YOU!!!
<ion_> In the future, hopefully stuff like that and ACPI events etc. are also transformed to Upstart jobs.
<Jc2k> ion_: this is a bit off topic, but do you know if i could put something in /etc/network/if-preup.d to make NetworkManager ignore a new device matching certain criteria?
<Jc2k> i only ask because you mentioned if-up.d
<ion_> I donât know. Perhaps add an udev rule so that it always gets the same interface name and define that interface in /e/n/interfaces.
<Jc2k> well thats the problem.. i want something that i can package..
<sadmac2> Keybuk: internet troubles?
<sadmac2> good answer
<soren> :)
#upstart 2008-05-06
<ion_> ma032912 < ion_> Note to self: mention to Keybuk:
<ion_> ma032917 < ion_> http://www.netsplit.com/2008/04/27/upstart-05-events/ âinstance TTYâ
<ion_> ma034051 < ion_> http://www.netsplit.com/2008/04/12/upstart-05-job-lifecycle/ âANdâ
<Keybuk> ?
<sadmac2> Keybuk: how's the trip?
<Keybuk> sadmac2: just started today
<sadmac2> Keybuk: ahh. Figured from your connection problems yesterday that you were already there and on borrowed wireless
<Keybuk> yeah, was at the hotel last night
<sadmac2> Keybuk: what time is it there? 1pm? 2?
<Keybuk> 2pm
<sadmac2> ah. +5.
<Keybuk> yeah, usual UK time
<Keybuk> how weird
<Keybuk> joining FreeNode kicks me off the network here
<ion_> Here?
<Keybuk> at this hotel
<ion_> Interesting :-)
<Keybuk> random innit
<ion_> How about another IRC network, or another Freenode port?
<Keybuk> other IRC networks seemed ok
<Keybuk> easier to just bounce through another machine
<ion_> Yeah. Fortunately they don't consider ssh evil. :-)
<Keybuk> is probably more likely crashing a nat module or something
<wasabi> that sounds exploitable. :0
<ion_> What OS is the gateway running?
#upstart 2008-05-07
<Keybuk> who knows
<ion_> nmap for one
<Keybuk> heh, I'm not that interested ;)
<Keybuk> heh that was weird
<Keybuk> I was able to start upstart 0.5 alongside 0.3
<Keybuk> even though I thought both claimed the UNIX abstract /com/ubuntu/upstart path
<Keybuk> without error ...
<Keybuk> of course, previously that was a DGRAM socket
<Keybuk> now it's a STREAM
<Keybuk> so that's allowed
<ion_> Heh
<sadmac2> Keybuk: what does that socket do now/since dbus?
<Keybuk> sadmac2: it's for when the dbus daemon isn't available
<sadmac2> Keybuk: ah.
<Keybuk> it's basically for initctl only
#upstart 2008-05-08
<sadmac2> Keybuk: howgoezit?
<Keybuk> sadmac2: slowly
<sadmac2> Keybuk: what are you up against?
<Keybuk> lack of time
<sadmac2> what still needs doing?
<Keybuk> all of the ipc work
<sadmac2> anything you could hand off? I have plenty of time right now.
<Keybuk> not unless you've already figured out how to write bindings with libnih-dbus? :)
<sadmac2> is it difficult to pick up?
<Keybuk> not especially
<sadmac2> well then I may as well give it a shot
<sadmac2> where should I pull from?
<Keybuk> trunk
<Keybuk> of both upstart and libnih
<Keybuk> there's various notes in the irc logs of what we want to end up with
<Keybuk> also will need a signed copy of http://upstart.ubuntu.com/wiki/CopyrightAssignment
<Keybuk> assuming you're at RH now, probably by line manager or someone authorative?
<sadmac2> interesting point. hmm...
<Keybuk> http://bazaar.launchpad.net/~keybuk/upstart/trunk/revision/scott%40netsplit.com-20080508182154-90pnmwt4j18ryzhk?start_revid=scott%40netsplit.com-20080508182154-90pnmwt4j18ryzhk
<Keybuk> \o/
<Keybuk> ^ big milestone push
<sadmac2> Keybuk: aand launchpad is being slow
<sadmac2> ok
 * sadmac2 goes to rebase or whatever you bzr people call it
<Keybuk> "update" :)
<Keybuk> (or pull if you branched instead of checked out)
<sadmac2> Keybuk: I did "merge" and that seemed to get it
<Keybuk> that works too
<sadmac2> what's the difference between branch and checkout?
<Keybuk> a branch is your own personal branch
<Keybuk> any changes you make remain on your machine until you push them somewhere
<Keybuk> a checkout is exactly like that, but any changes you make are pushed back to where you branched from
<Keybuk> ie. it's the subversion/cvs model of working
<Keybuk> whereas branch is the distributed model
<sadmac2> ah
 * sadmac2 likes branch
<Keybuk> the nice thing being that if the push fails, the commit need not
<Keybuk> so you can work centrally, and get on a plane, and carry on committing
<Keybuk> when you have a connection again, you just merge in everyone else's changes, and push and rebind
<Keybuk> I don't tend to checkout much myself
<Keybuk> I tend to use branch/pull/push
<Keybuk> even if I'm the only person with write access to the pull/push location
<Keybuk> since then I can stage pushes
<sadmac2> yes. I'm young enough and avant garde enough that git marks the vast majority of my version control experience.
<Keybuk> heh
<Keybuk> I dislike git strongly
<Keybuk> well
<Keybuk> it appears to dislike me strongly
<Keybuk> it vastly overcomplicates things which should be simple
<sadmac2> I havent' found such
<sadmac2> you should try this 'eg' thing though. people seem to like it
 * Jc2k has had a bad git experience today
<Keybuk> eg?
<sadmac2> Keybuk: "easy git." Its a little wrapper layer that's got a lot of people very pleased
<sadmac2> Jc2k: what was it?
 * Jc2k won't be ready to try playing with git again for a while
<Keybuk> sadmac2: but bzr already does everything I need without any wrappers ;)
<Jc2k> the amount of effort to add a new repository
<Keybuk> and I know where the author lives, and haven't popped round to stab him in the face
<Keybuk> this, to me, is a great achievement in revision control systems ;)
<Jc2k> with bzr i just pushed to sftp (also a location http can see)
<Keybuk> "Hi Scott, my name's Brian, I'm one of the authors of subver*ARRRRGH MY EYEE!!!!*"
<sadmac2> Keybuk: as originally intended, it wouldn't be fair to compare git and bzr, any more than it would be fair to compare sysvinit and libnih
<Jc2k> with git, i have to run git-update-this and add hooks so that git-update-that gets called every commit and...
<sadmac2> git was a filesystem. it was never meant to be left on its own
<sadmac2> this has become far less true
<sadmac2> Jc2k: don't use webdav
<Keybuk> sadmac2: git was always intended to be a revision control system ;)
<sadmac2> Jc2k: stick to the custom daemon
<sadmac2> Keybuk: it was not intended to be interacted with by the user directly
<Keybuk> sadmac2: sure it was
<Keybuk> where the user == Linus
<Jc2k> sadmac2: i was meant to be quickly throwing some repos up so that the upstream debian maintainer of my ubuntu synce packages got some fixes
<Keybuk> but then other people realised that Linus is quite, quite mad
<Keybuk> and wrapped it with friendlier things
<Jc2k> sadmac2: it took 4 attempts before he could finally access them.
<Keybuk> and claimed that it was never intended to be unwrapped in the first place
<sadmac2> Jc2k: using which method? webdav or git-daemon?
<Keybuk> git reminds me a lot of arch
<Keybuk> I think it's the first distributed revision control system that people try
<Jc2k> sadmac2: does bog standard http really qualify as webdav? but yes, webdav. because i excpected it to be as simple as bzr.
<Keybuk> and they fall in love with the idea of DVCS so much, and think it's so awesome, that they'll apologise for any user interface problems
<sadmac2> Jc2k: webdav is not the way to do it.
<sadmac2> Jc2k: use the git-daemon
<Keybuk> what hg and bzr have shown is that you can do DVCS, and still have a simple client that largely does the right thing
<Jc2k> sadmac2: i started working to set that up
<Keybuk> without exposing its inner workings
<Keybuk> it's still distributed, it's still awesome, but it feels less like having a spike pushed through your testicles
<Jc2k> sadmac2: if i use git-daemon, do i still have to log on to the server, create a new repo, poke things into its hooks, ln it to /var/cache/git and such?
<sadmac2> log on/create I believe still apply. The rest shouldn't
<Jc2k> so i'll still be using bzr when i quickly want to share a branch.
<Keybuk> bzr push sftp://hostname/home/scott/public_html/some-branch
<Keybuk> ;)
<sadmac2> Jc2k: remember: 1 git repo => many branches
<Jc2k> Keybuk: doesn't it support ~ these days?
<Keybuk> yeah probably
<sadmac2> Jc2k: its a once-per-project operation, not once-per-branch
<Keybuk> sadmac2: ssh hostname bzr init-repo public_html/bzr
<Keybuk> bzr push sftp://hostname/home/scott/public_html/bzr/some-branch
<Keybuk> (in fact, you can probably just init-repo the sftp url ;p)
<sadmac2> Jc2k: and if you quickly want to share a branch, why on the server? Just share it off your own damn box like it was designed for
<Jc2k> sadmac2: generally behind NAT
<sadmac2> Jc2k: good point
<sadmac2> that is one area where bzr is just better. Git's almost TOO distributed. The idea of ANY centralization was an afterthought. hence the trouble.
<Keybuk> I've never seen anywhere that git is more distributed than bzr?
<Keybuk> bzr's repository model was just designed from scratch to be flexible
<Keybuk> any bzr repository is a branch someone can take
<Keybuk> bzr branch ~someoneelse/work/foo  -- will take a branch from their last committed change
<sadmac2> Keybuk: well its more a mindset question than anything. The idea of a central git repo just didn't occur to anyone until late in the game
<Keybuk> hell, the only difference between bzr branch and cp -a is that bzr branch doesn't take the .o files with it ;)
<Jc2k> and the level of integration from bzr-svn astounds me
<sadmac2> Remember, Linus doesn't even necessarily think there should be a single convergence point.
<Jc2k> i'm a little surprised there isn't a bzr-git, but i don't think there is someone who wants to use both
<Keybuk> there is?
<suihkulokki> sadmac2: is there actually any project where developers push/pull biderectionally from each others? there allways seems to be a central repository in projects ive been at.
<Jc2k> Keybuk: but its not like bzr-svn, is it? last time i looked it wasn't as feature complete..
<suihkulokki> s/any project/any git project/
<Keybuk> it's not as complete, no?
<sadmac2> suihkulokki: Red Hat does it that way internally. When you pull in here, usually its coming directly from a folder in someone's NFS home
<suihkulokki> sadmac2: we tried to do that to a relatively small project and the repo was messed in not time..
<sadmac2> suihkulokki: we've been doing it without issues for all of IT for awhile now
<Keybuk> heh, we just don't use revision control ;)
<Keybuk> the debian archive system is kinda like a primitive rcs in of itself
<sadmac2> One claim bzr made that's bugged me: They said on their webpage "bzr never commits a merge automatically, which is safer if it breaks things"
<sadmac2> WHO CARES?
<sadmac2> Without autocommit: git reset HEAD With autocommit: git reset HEAD^
<sadmac2> the workflow is nearly identical
<Keybuk> sadmac2: it's just the CVS model
<Keybuk> bzr merge ... bzr commit
<Keybuk> svn follows the same pattern
<Keybuk> anyhoo, skating time
<Keybuk> bbl
<sadmac2> Keybuk: I'm not saying its worse, its totally fine. but they go screaming for 20 minutes "git is unsafe because it does this!"
<sadmac2> Keybuk: so basically these NihDBusInterface[] arrays need to be populated with whatever self-evident handlers
<sadmac2> (which in turn need to exist)
<sadmac2> Which is the real Keybuk ?
<Keybuk> well, that pretty much confirms that it's just FreeNode that this hotel hates
<sadmac2> heh
<sadmac2> Keybuk: so what I'm gathering from the source here is that we have manager_interfaces[] and job_class_interfaces[] which need to be populated with appropriate handlers
<Keybuk> pretty much
<Keybuk> the handlers are all autogenerated though
<sadmac2> ah yes. the magical mystery python script
<Keybuk> crap, wrong button
<sadmac2> heh
<Keybuk> sadmac2: did you get the trunk libnih and upstart to build ok?
<sadmac2> Keybuk: haven't built 'em. I'll want to build them under F9 at home I think
<sadmac2> (Work box is RHEL 5)
<Keybuk> ah right
<Keybuk> wanted to see whether it worked ok
<Keybuk> I added some compiler flags ;)
<sadmac2> meh. I have a compiler. I can build it for the sake of building it
<sadmac2> lets do this
<Keybuk> :)
<Keybuk> add CPPFLAGS=-DDEBUG
<sadmac2> ../libnih/nihify 
<Keybuk> yeah, well
<Keybuk> configure libnih
<Keybuk> then nihify upstart
<Keybuk> then configure and build upstart
<sadmac2> aaand stopped
<sadmac2> Autoconf version 2.61
<sadmac2> :(
<sadmac2> don't have that in 5
<Keybuk> heh
<Keybuk> why's the work box so out of date?
<sadmac2> Keybuk: its RHEL.
<sadmac2> The customers seem to prefer things this way
<sadmac2> ...I could grab the f9 package out of koji....
<Keybuk> that's the latest release of RHEL?! :)
<Keybuk> what is it?! Debian?! :p
<AlexExtreme> RHEL releases are eons apart
<Keybuk> how do you build stuff on there?
<sadmac2> Keybuk: anything we're shipping builds with the versions available. Anything customers want to build themselves isn't within our direct support ring and they need to talk to the people that wrote it.
<Keybuk> yeah, but how do you develop for fedora on RHEL?
<sadmac2> Keybuk: I don't. I've been in sysadmin positions until... well two weeks from now
<sadmac2> the fedora stuff has been free time
<sadmac2> (which I have a lot of since the department I'm in now doesn't have much work for me)
<Keybuk> ahh right
<Keybuk> work != RH
<Keybuk> ?
<sadmac2> Keybuk: also ssh
<sadmac2> Keybuk: yeah, I work at RH. I was an IT release engineer, now I'm engineering operations.
<Keybuk> oh, got you
<sadmac2> the former was mostly scripting, the latter consisted of lifting heavy objects and bolting them to high places.
<Keybuk> :-)
<sadmac2> I have to go dig up the 0.3.9 source so I can remember what all this stuff did
<Keybuk> which stuff? :)
<sadmac2> jusw what messages need to be responded to.
<sadmac2> s/jusw/just
<Keybuk> most of it probably won't be a 1:1 mapping
<sadmac2> yeah.
<sadmac2> Where is the script that does the autogenerating?
<Keybuk> in libnih
<sadmac2> ahh. was looking for green in ls
<sadmac2> ahh, and my favoritest part about RHEL 5
<sadmac2> Python 2.4.3
<sadmac2> Keybuk: Your script keeps saying "Name may ot be null"
<sadmac2> where do I put the name? I tried an attribute, I tried a tag...
<sadmac2> nvm. I get it now
<Keybuk> it's just d-bus introspect format as input
<sadmac2> ah
 * sadmac2 should RTFM on dbus
<Keybuk> heh
<Keybuk> I wish there was a d-bus style guide
<Keybuk> like what should the primary interface be?
<Keybuk> if it's /com/ubuntu/Upstart
<Keybuk> should the interface be com.ubuntu.Upstart
<Keybuk> or com.ubuntu.Upstart.Manager
<Keybuk> or com.ubuntu.Upstart.Server
<Keybuk> etc.
<sadmac2> if either of the later two, what would the first then mean?
<Keybuk> you'd just have one?
<Keybuk> davidz services seem to use Manager
<Keybuk> hughsie services seem to just use the dotted version of the path
<sadmac2> It just seems to me that if com.ubuntu.Upstart is a valid option it should either be it, or it should be something with some sort of ownership relation to com.ubuntu.Upstart.{Manager,Server,whatever}
<Keybuk> how do you mean?
<Keybuk> as in you get from one to the other?
<sadmac2> when I see com.ubuntu.Upstart.Manager, the relationship, to me, reads com.ubuntu.Upstart HAS A Manager
<sadmac2> if something can HAVE A other thing, that implies that there is something doing the having, which suggests one could interact with com.ubuntu.Upstart directly
<sadmac2> so what interface does com.ubuntu.Upstart present? and if none, why?
<Keybuk> yeah that's my thinking too
<Keybuk> the /com/ubuntu/Upstart object should have the com.ubuntu.Upstart interface
<Keybuk> which allows you to do things like get jobs (com.ubuntu.Upstart.Job interface), etc.
<sadmac2> plus Server kind of nods at an implementation detail, and Manager is a -er classname, which I have pages of angry rants about
<Keybuk> ok, no -ers :p
<sadmac2> Its fun to program in java when you have that disposition :)
<sadmac2> BufferedStreamReader *shudder*
<Keybuk> ;)
<Keybuk> make[2]: Entering directory `/home/scott/co/upstart/init'
<Keybuk> ../nih/nih-dbus-tool \ --mode=object --prefix=control --output=com.ubuntu.Upstart_object.c ../dbus/com.ubuntu.Upstart.xml
<Keybuk> schweet
<Keybuk> actually I should s/_object// for those
<Keybuk> that was only for the test suite
<sadmac2> yea
<sadmac2> anything in that Upstart file yet?
<Keybuk> not yet
<sadmac2> hm. I'll see if I can populate it tonight
<sadmac2> local lug meeting is in 1/2 hour downstairs. I'll probably be going to that.
<sadmac2> Keybuk: did you ever integrate that RPM patch I sent?
<Keybuk> err, which patch was that
<Keybuk> I thought I did
<sadmac2> Keybuk: it just added code to where you were ignoring .dpkg files to ignore some of rpm's weird things
<Keybuk> hmm, not on this PC
<Keybuk> let me commit that now
<sadmac2> Keybuk: I don't know where it would be in the new design
<sadmac2> Keybuk: I can't find even the dpkg stuff
<Keybuk> same place
<Keybuk> what was the ;[abcdefABCDEF0123456789] thing fabout?
<sadmac2> Keybuk: when rpm first puts a file down on the system, it puts it into place with a ;<some hex> appended to it. Then when everything is laid out, it moves them to the right name
<sadmac2> Keybuk: its an atomicity thing
<ion_> keybuk: I find com.ubuntu.Upstart nice.
<Keybuk> ah right
<ion_> So just ignore files with semicolons in addition to files with dots?
<Keybuk> ion_: we don't ignore files with dots anymore
<sadmac2> ion_: its ignoring files with ;<hex num>. I was able to match the pattern fairly simply
<Keybuk> the matching is somewhat smarter
<ion_> Oh, ok.
<Keybuk> wing-commander upstart% dbus-send --system --dest=com.ubuntu.Upstart --type=method_call --print-reply /com/ubuntu/Upstart com.ubuntu.Upstart.GetJobByName string:"foo"
<Keybuk> method return sender=:1.1567 -> dest=:1.1571 reply_serial=2 object path "/com/ubuntu/Upstart/jobs/foo"
<Keybuk> \o/
<ion_> Btw, now that Fedora is going the Upstart way, will Red Hat follow? Sorry for my ignorance, but i have no idea how Fedora and Red Hat relate to each other nowadays.
<sadmac2> This calls for an image macro
<sadmac2> ion_: The rule was "Every 3rd fedora release becomes a RHEL" which would have meant f9 -> RHEL 6, but customers aren't really demanding a new version, so we'll probably wait.
<sadmac2> ion_: but yes, the next RHEL fork will almost certainly pick up Upstart
<ion_> Alright, nice.
<Keybuk> when is f9 out?
<sadmac2> Keybuk: days. there may be a gold version floating about now
<Keybuk> cool
<sadmac2> Not topical, but:
<sadmac2> http://people.fedoraproject.org/~sadmac/hula.jpg
<sadmac2> And now to LUG. l8r
#upstart 2008-05-09
<ion_> :-)
<Keybuk> wing-commander upstart% dbus-send --system --dest=com.ubuntu.Upstart --type=method_call --print-reply /com/ubuntu/Upstart/jobs/bar com.ubuntu.Upstart.Job.GetInstanceByName string:"debug"
<Keybuk> method return sender=:1.1602 -> dest=:1.1605 reply_serial=2 object path "/com/ubuntu/Upstart/jobs/bar/debug"
<Keybuk> kewlios
<Keybuk> wing-commander upstart% dbus-send --system --dest=com.ubuntu.Upstart --type=method_call --print-reply /com/ubuntu/Upstart/jobs/foo com.ubuntu.Upstart.Job.GetInstanceByName string:"active"
<Keybuk> Error com.ubuntu.Upstart.Error.Singleton: Singleton jobs do not have named instances
<ion_> I'm thinking that perhaps there should be no differentiation between singleton jobs and ones with multiple instances â just assume 'instance default' or something similar as the default, which makes it a singleton and the same logic applies to all jobs.
<Keybuk> the plan is for a GetInstance(Array of String env) function
<Keybuk> which will hide the difference
<ion_> But does there need to be a difference in the first place?
<Keybuk> it saves having a "magic" instance name
<Keybuk> or other strange behaviours like all names are true
<Keybuk> the difference is exposed to the job as well
<Keybuk> singleton jobs don't get a $UPSTART_INSTANCE variable in their environment
<Keybuk> nor do they export an $INSTANCE variable in their events
<Keybuk> start on stopped apache failed
<Keybuk> instead of
<Keybuk> start on stopped apache MAGIC failed
<Keybuk> it seemed like the right approach ;)
<Keybuk> of course, it's more code to actually do it that way, so I'm willing to be persuaded ;-)
<Keybuk> (after my bath - bbiab)
<ion_> I was thinking that it would be more elegant if the implementation under the hood didn't know the difference between singleton and instanced jobs and the user interface was the one that does something (didn't think that far yet) to avoid exposing the "magic" variable. It wouldn't really be magic, it would just be anything constant.
<ion_> But if the part about moving the separation from the job implementation to UI makes the UI code suck, it's not worth it of course.
<ion_> With UI, i mean the public API and job files.
<ion_> For instance, the API could expose a GetInstance method that only returns a single instance when the job's "instance" value does not reference a variable.
<ion_> And it would be kind of nice if 'start on stopped apache failed' caused the job to start whenever 0) any apache instance fails if apache has instances or 1) the apache instance fails if it's singleton.
<ion_> Perhaps have the instance after 'failed'? That wouldn't be as pretty though.
<Keybuk> I originally put $INSTANCE at the end
<Keybuk> but moved it forwards because it made more sense
<Keybuk> start on stopped getty tty1
<Keybuk> start on stopped rc 2
<ion_> Yeah
<Keybuk> internally there isn't *much* difference
<Keybuk> singleton jobs have a single instance called NULL
<Keybuk> the "get instance" function always returns it
<Keybuk> and things like job name in messages and environment know not to add the instance name
<Keybuk> it is, admittedly, quite odd that
<Keybuk>   instance blah
<Keybuk> and omitting instance have exactly the same effect
<Keybuk> but behave differently
<ion_> It seems they decided that running water isn't needed here.
<Keybuk> heh
<Keybuk> badness
<Amaranth> eh, who needs it?
<Keybuk> maybe the right thing to do is accept "" as NULL
<Keybuk> so GetInstanceByName("") would return it
<ion_> That sounds okay.
<Keybuk> should it have UPSTART_INSTANCE="" in its environment and INSTANCE="" in its events?
<Keybuk> ah, you can't _have_ empty environment variables
<Keybuk> heh
<ion_> Hm
<ion_> % export foo=; env | grep foo
<ion_> foo=
<ion_> % sh
<ion_> $ env | grep foo
<ion_> foo=
<Keybuk> $ foo=
<Keybuk> $ $ env | grep foo
<Keybuk> $ 
<Keybuk> oh, forgot export
<Keybuk> damn
<Keybuk> so back to the question
<ion_> Exactly what are the implications of having INSTANCE="" in the events? Still using the same parameter order for e.g. 'failed' events?
<Keybuk> well, you'd have to do
<Keybuk> start on stopped apache "" failed
<Keybuk> or just use
<Keybuk> start on stopped apache RESULT=failed
<ion_> Yeah... The latter one isn't that bad IMO.
<Keybuk> is this nicer?
<Keybuk>   start on stopped apache FAILED=pre-start
<Keybuk> or
<Keybuk>   start on stopped apache FAILED=*
<Keybuk> ie. rather than have RESULT=failed /and/ PROCESS=pre-start, combine them
<ion_> I'm not quite sure which is nicer.
<Keybuk> FAILED=* is a little less readable I guess
<ion_> True
<Keybuk> and you can't invert match
<Keybuk> ie you wouldn't be able to match _not_ failed ;
<Keybuk> RESULT=ok works
<ion_> Right
<ion_> So, the default would be 'instance ""', where "" would be the canonical instance name for a singleton job?
<Keybuk> yup
<ion_> Sounds good to me.
<Keybuk> based on the above logic, that could be any string
<Keybuk> is there something better than just "" ?
<ion_> The user would have the ability to do 'instance foo', but would just have to accept that then the canonical GetInstanceByName("") wouldn't work.
<Keybuk> or should we leave the something better for people who want to "instance xxx" it for nefarious purposes
<Keybuk> right, GetInstanceByName("foo") is what worked - they defined the instance name
<ion_> I find "" a good default. Just document that 'instance ""' is the right thing to do (and the default value) for a singleton job and GetInstanceByName("") is the canonical way to get to it.
<Keybuk> and its dbus name would be /_ or something?
<ion_> Hm. Or perhaps have such magic in the d-bus code that GetInstanceByName("") and /_ point to the single instance whenever 'instance foo' doesn't refer to any variables?
<ion_> That would be the Officialâ¢ definition of singleton jobs: 'instance ...' doesn't refer to any variables.
<Keybuk> that would be hardy
<Keybuk> harder
<Keybuk> freudian slip there
<Keybuk> and I'm not sure that's right either
<ion_> Yeah...
<Keybuk> I think it's quite valid to have a getty job with just "instance tty1"
<Keybuk> you want to be compatible with someone else's getty job that does use instances
<Keybuk> and you wouldn't want that working for tty2
<ion_> How about 'instance $TTY' and fail if $TTY != "tty1" in pre-start script?
<Keybuk> that's another way to do it
<Keybuk> less clean though
<Keybuk> I think that the instancebyname returning the answer for anything would be a little surprising
<Keybuk> and leading people to actually check the name after to ensure what they had
<Keybuk> e.g.
<Keybuk> name = "tty4"
<ion_> True
<Keybuk> instance = GetInstanceByName(name)
<Keybuk> // can't assume instance->name == name
<Keybuk> ok
<Keybuk> as usual, 20s to do, 20m to update the tests
<Keybuk> but now Upstart has _no_ singleton functionality
<Keybuk> it just happens that the default value for instance is ""
<ion_> Nice
<Keybuk> and yay
<Keybuk> I got rid of the annoying function
<ion_> What was that?
<Keybuk> job_instance ()
<Keybuk> it can now just be nih_hash_lookup
<Keybuk> it was annoying because it really should have been inside job_class, but couldn't be, because it returned Job
<Keybuk> wing-commander upstart% dbus-send --system --dest=com.ubuntu.Upstart --type=method_call --print-reply /com/ubuntu/Upstart/jobs/foo com.ubuntu.Upstart.Job.GetInstanceByName string:""      
<Keybuk> method return sender=:1.1669 -> dest=:1.1671 reply_serial=2 object path "/com/ubuntu/Upstart/jobs/foo/_"
<Keybuk> there we go
<ion_> Hmm
<ion_> keybuk: How about foo: 'instance $BAR', start foo BAR=""
<ion_> It would *work*, of course, but e.g. a GUI could not just test whether there's a running instance called "" and say it's singleton, it would have to check the value of 'instance ...'
<Keybuk> why would the GUI care?
<Keybuk> one of the things I like is that there's no such thing as a singleton job anymore
<Keybuk> all jobs are multi-instance, just for different values of multi, including one
<ion_> Yeah, i didn't really think *why* the GUI should care. :-) But yeah, that's the elegance i meant.
<sadmac2> Keybuk: Fedora comes out on Tuesday
<Keybuk> cool
<Keybuk> man, D-Bus arrays are fiddly
#upstart 2008-05-11
<Keybuk> I can't help but notice that little discussion is actually happening on #unix-init
<Keybuk> or the attached mailing list
<ion_> Heh, yeah
<Keybuk> I still want to know what the big security panic is
<ion_> Security panic?
<Keybuk> yeah, still embargo'd
<Keybuk> I have no idea what it is
<Keybuk> just that I was told not to ask lest by weekend be ruined by the panic
<ion_> Wait, what? I donât understand anything you said. :-) I must be missing something obvious here.
<ion_> Security, as in the hardy-security repo perhaps? Embargo? I havenât been reading mailing lists for a while. :-)
<rgl> hi
<rgl> how do we disable an event from starting? 
<rgl> I mean, I created /etc/event.d/foo but how do I disable it?  doing a stop foo stops the service, but the next time the system boots, its started again.
<Keybuk> when testing arrays of int, it's very hard not to use the numbers 4, 8, 15, 16, 23 & 42
<Keybuk> today's task:
<Keybuk> design an API for D-Bus properties
<Keybuk> can't decide which would be best
<ion_> Hehe (the numbers)
<Keybuk> for the property API, which sounds better
<Keybuk> 1) for each property, you have to define a _get and _set function
<Keybuk> 2) for each property, you have to define a single function which takes two arguments (set from first, store old value in second)
<Keybuk> 3) you have to define a single _get and _set function, which gets passed the property to set/get and a union of the possible types
<ion_> What are these properties?
<Keybuk> job name, description, goal, state, etc.
<ion_> I donât like 2) a lot. 1) would make a pretty API, but because of Câs lack of dynamicity, you wouldnât be able to e.g. iterate over an array of properties and _get each one of them (for a GUI for instance).
<Keybuk> sure you would
<ion_> So i guess iâd choose 3). Perhaps iâm missing some considerations.
<Keybuk> remember that these are accessor functions
<Keybuk> for job in manager.GetAllJobs():
<Keybuk>     for name, value in job.GetAllProperties():
<ion_> Oh, sorry, i thought this being a C API, not a D-Bus API.
<Keybuk>         print name, value
<Keybuk> C API you just do obj->value ;)
<ion_> Ah, ok.
<Keybuk> this is the functions to convert the struct into d-bus properties that the GUIs can use
<Keybuk> so there'd be a goal property, a state property, a name property, etc.
<Keybuk> having
<Keybuk> job_class_get_name (...)
<Keybuk> job_get_goal (...)
<Keybuk> job_get_state (...)
<Keybuk> is a lot of properties
<Keybuk> admittedly, almost all of them are going to be get only given the design
<Keybuk> with class one settable to the object that made them I guess
<ion_> Iâm not sure whether to pick 1) or 3).
<Keybuk> the main problem with 3 is that the types are so varied I guess
<Keybuk> so you'd need a "JobClassProperty" union
<Keybuk> which is a bit crappy
<Keybuk> at least 1) you just write lots of very very simple functions
<ion_> Indeed
<Keybuk> int
<Keybuk> job_get_goal (Job *job, NihDBusMessage *message)
<Keybuk> {
<Keybuk>  err.
<Keybuk> int
<Keybuk> job_get_goal (Job *job, NihDBusMessage *message, const char **goal)
<Keybuk> {
<Keybuk>     *goal = job_goal_name (job);
<Keybuk>     return 0;
<Keybuk> }
<ion_> If the amount of functions with 1) isnât a problem, iâd pick it.
<Keybuk> I think that the thought that they'll be get only for the majority has made me happier about that
<Keybuk> not sure how to do job setup
<Keybuk> you'd do a d-bus call to define a source, which would be attached to your d-bus unique name (so if you disconnect, your jobs are all deleted)
<Keybuk> you'd then need to define files and attach jobs to them
<Keybuk> and set up the jobs before committing them
<Keybuk> after committing, you wouldn't be able to change the job
<Keybuk> you'd create a new one and delete the old
<Keybuk> or the changes could be always permitted, and always result in the old being automatically deleted
<Keybuk> ion_: security embargos are no fun :-(
<Keybuk> even I'm not allowed to know what the big security panic is
<Keybuk> all I'm told is that it's very scary, and we'll all know on Tuesday
<sadmac> Keybuk: yo
<sadmac> Keybuk: RH is still sorting through the assignment agreement, but I could get going now and just wait to commit until they straighten it out
<Keybuk> sadmac: tbh, most of the help I need right now is in testing
<Keybuk> am making fast progress now
<sadmac> Keybuk: good to hear :)
<Keybuk> if you can compile it with -DDEBUG and create test jobs in /etc/init/jobs.d (you get a "debug" event instead of a startup one)
<Keybuk> and see if you can crash it then
<sadmac> Keybuk: I have only my laptop now (left my school housing, so my boxen are packed away) so I'll probably have to wait until I get to westford to requesition a good test box
<sadmac> Though I don't mind crashing the lappy a bit.
<Keybuk> heh, don't install
<Keybuk> if compiled with DEBUG you can just run init as a normal user out of the src directory
<sadmac> Keybuk: and when doing that it will look in /etc/init/jobs.d?
<Keybuk> yeah
<sadmac> yeehaw
<sadmac> in 2 days I'll probably be running 0.3.9 by default
<sadmac> assuming I can get upgraded right away
<sadmac> Keybuk: getting these:
<sadmac> configure.ac:31: required file `intl/Makefile.in' not found
<sadmac> configure.ac:14: required file `./ABOUT-NLS' not found
<sadmac> configure.ac:18: required file `./ltmain.sh' not found
<sadmac> Makefile.am:3: required directory ./intl does not exist
<sadmac> trying to build libnih
<Keybuk> did you run autoreconf -i ?
<sadmac> no -i
<Keybuk> that might help
<sadmac> heh
<sadmac> Keybuk: does init fork or should I launch it in the background?
<Keybuk> just leave it in the foreground so you can watch the output?
<sadmac> Keybuk: ahh
 * sadmac Ctrl+a c
<sadmac> Keybuk: it seems initctl doesn't build by default in trunk
<Keybuk> no, it's not done yet
<sadmac> Keybuk: ahh. that'd do it
#upstart 2009-05-04
<mlaze> hello there
<mlaze> any upstart developer around ?
<kfries> Are there any active listeners on this channel to ask a quick question of?
<damjan> .
<damjan> . .
<damjan> . . .
<damjan> Â· Â· Â· Â· Â· Â·
<kfries> I have been reading the docs by sjs on the netsplit website, and have a question on best practice
<kfries> If I wanted to start something like named from upstart to get it to monitor (respawn), would it be best to start it with a -f to keep it in the forground, or to let it spawn into a backgroud process?
<kfries> oops that sjr, sorry scott
<sadmac_> kfries: -f
<kfries> awesome, its slowly starting to become a clear as mud to me, but I'm trying.  Thx for the answer, I'm sure I will have more later
#upstart 2009-05-05
<tech404> So is the reason that almost all the scripts simply trigger old scripts due to the fact everything has not been finalized? I thought we would have seen more services with their own events by now.
<tech404> s/scripts/events/
<Keybuk> tech404: right
<mlaze> hello there
<mlaze> any upstart developer around ?
<sadmac> mlaze: what's up?
<mlaze> i've been reading upstartcode
<mlaze> for a while trying to figure out how to use ptrace
<mlaze> though i'm a little confused
<sadmac> upstart is not a good ptrace tutorial
<sadmac> its not even a good use case for ptrace
<mlaze> i believe so but t's pretty much readable than gdb for example
<sadmac> there's better options still
<sadmac> strace for one
<mlaze> the point is that upstart traces for forks and execs wich is exactly what i'm trying to do
<sadmac> so does strace :)
<sadmac> if your use case is similar to ours then ptrace is the wrong way to do it. Its going away soon.
<sadmac> Granted only Keybuk knows the /right/ way, and he's not giving out the details (you can dig them out of obscurity in the kernel source if you want to).
<mlaze> yup, after spending some time reading upstart i've figured out that
<mlaze> waitid and ptrace documentation lacks on some subjects
<mlaze> sadmac: has i suspected, strace doesn't trace forks using PTRACE_SETOPTIONS
<mlaze> but thanks for the tips
<mlaze> anyway
<sadmac> np
#upstart 2010-05-10
* Keybuk changed the topic of #upstart to: Upstart 0.6.6 "No, she's dead, this is her son" | http://upstart.ubuntu.com/ | "Upstart Q&A" today 1000UTC http://icecast.ubuntu.com:8000/ginko.ogg.m3u #ubuntu-uds-ginko
<Keybuk> "Upstart Q&A" today 1000UTC http://icecast.ubuntu.com:8000/ginko.ogg.m3u #ubuntu-uds-ginko
* Keybuk changed the topic of #upstart to: Upstart 0.6.6 "No, she's dead, this is her son" | http://upstart.ubuntu.com/ | "Upstart Q&A" today 1000UTC http://icecast.ubuntu.com:8000/ginko.ogg.m3u #ubuntu-uds-ginko | Further sessions Wednesday-Friday, see http://summit.ubuntu.com/uds-m/
<Stevee> hello, i've a question on upstart: is it possible to start a jobfile if there is no other job running
<Stevee> or a event which get emited if there are all jobs stopped ?
<Stevee> for example on trobules during boot process to get into an emegency shell
<Stevee> or something like that
<Stevee> or to reboot system if everything is gone
<sadmac> Stevee: no. Used to be. It was removed.
<Stevee> oh thats bad....
#upstart 2010-05-11
<mgoetze> Keybuk: i would be much obliged if you could have a glance at LP#575244
<Keybuk> that's not an Upstart bug
<mgoetze> right, that's why i reassigned it to udev
<Keybuk> yes, but you're asking about it on #upstart ;-)
<Keybuk> #udev is --> that way :p
<sadmac> Keybuk: how's upstart next coming?
<Keybuk> shaping up nicely
<Keybuk> did you dial into the session yesterday?
* Keybuk changed the topic of #upstart to: Upstart 0.6.6 "No, she's dead, this is her son" | http://upstart.ubuntu.com/ | Upstart-related UDS sessions Wednesday-Friday, see http://summit.ubuntu.com/uds-m/
<ion> I missed it.
<sadmac> Keybuk: session?
<ion> At UDS
<sadmac> I didn't know you could dial in to UDS
<sadmac> $dayjob has given me a pile of urgent shit to do today. hopefully wednesday I'll be free
<sadmac> http://itsuki.fkraiem.org/stuff/lucid.jpg
<Daenyth> Hi
<Daenyth> What's the best way for me to get a script to be run at shutdown/reboot time? Currently we have a script in init.d that runs on 0 and 6, and I've also just tried making an upstart conf that has "start on shutdown". Neither one appears to have worked. How can I do this?
<mgoetze> Daenyth: it depends on the rest of your configuration and your upstart version, but maybe you want "stop on runlevel [06]"
<mgoetze> er start on...
<Daenyth> And then run it as a stop script?
<Daenyth> I'd need it to hold the shutdown until the script finishes, it that easily done?
#upstart 2010-05-12
<twb> At http://upstart.ubuntu.com/wiki/Debugging it talks about using a &> redirection; a bashism.
<twb> Is that a documentation bug, or does upstart really use bash (and not dash)?
<plautrba> twb: upstart execs /bin/sh -e -c <your script>
<twb> Yeah, so I guess a Fedora user wrote that line
* Keybuk changed the topic of #upstart to: Upstart 0.6.6 "No, she's dead, this is her son" | http://upstart.ubuntu.com/ | Desktop & Upstart 0800UTC #ubuntu-uds-delfino http://icecast.ubuntu.com:8000/delfino.ogg.m3u | Server boot & Upstart 1000UTC #ubuntu-uds-cocobolo-2 http://icecast.ubuntu.com:8000/cocobolo-2.ogg.m3u | see http://summit.ubuntu.com/uds-m/
* Keybuk changed the topic of #upstart to: Upstart 0.6.6 "No, she's dead, this is her son" | http://upstart.ubuntu.com/ | Desktop & Upstart 0800UTC #ubuntu-uds-delfino http://icecast.ubuntu.com:8000/delfino.ogg.m3u | Server boot & Upstart 1000UTC #ubuntu-uds-cocobolo-2 http://icecast.ubuntu.com:8000/cocobolo-2.ogg.m3u | Finish Upstart 1300UTC #ubuntu-uds-delfino http://icecast.ubuntu.com:8000/delfino.ogg.m3u | see http://summit.u
<plautrba> twb: it's set in init/paths.h:#define SHELL "/bin/sh"
<Keybuk> Today's UDS sessions:
<Keybuk> Desktop & Upstart 0800UTC #ubuntu-uds-delfino http://icecast.ubuntu.com:8000/delfino.ogg.m3u
<Keybuk>  erver boot & Upstart 1000UTC #ubuntu-uds-cocobolo-2 http://icecast.ubuntu.com:8000/cocobolo-2.ogg.m3u
<Keybuk>  Finish Upstart 1300UTC #ubuntu-uds-delfino http://icecast.ubuntu.com:8000/delfino.ogg.m3u
<twb> Okey dokey.
<Homere> hello
<silwol> hi all. is there a default way to go when I want to run my upstart task as non-root user? I found no useful documentation for that on the net.
<Fantec> hello
<Fantec> I have to rewrite an init script to adapt it to upstart
<Fantec> the daemon needs disks to be detected but the number of disks and the device names may change (not all servers have exactly the same hardware)
<Fantec> I presume there is no event like "disk detection is ended" and that I have to wait for a specific delay after the system has started ?
<wasabi> There is no such thing as an end to disk detection.
<wasabi> At any moment a new disk could be added.
<wasabi> Most of that stuff is kicked off by udev, I believe.
<Fantec> yes, I was trying to find out a way to delay some daemons
* Keybuk changed the topic of #upstart to: Upstart 0.6.6 "No, she's dead, this is her son" | http://upstart.ubuntu.com/ | Upstart Q&A Session Video http://blip.tv/file/3606758 | see http://summit.ubuntu.com/uds-m
<Keybuk> http://blip.tv/file/3606758
<Keybuk> if you missed the Upstart Q&A session
<sadmac> komputes: did you get my email? (did I in fact send you an email? I may have just imagined it).
<sadmac> * Keybuk ^^
<sadmac> komputes: sorry.
<Keybuk> sadmac: I don't have an e-mail from you
<Keybuk> that may be the answer to your question
<sadmac> Keybuk: look at the latest news post on upstart.ubuntu.com, and the download page
<sadmac> Keybuk: notice anything missing?
<komputes> hi sadmac, i don't think i got your email what was it about?
<sadmac> komputes: I meant to speak to Keybuk, I hilighted you by mistake.
<komputes> sadmac: oh, ok
<Keybuk> 0.6.6?
<Keybuk> yeah, I can't login to that box right now <g>
<samjam> does upstart of location aware events? Or do I just invent one. Frinstance I dont want autofs to start if I'm not at home because it will hang my login.
<samjam> so do I just invent a process that emits the home event if it finds out I am at home?
<samjam> (based on a result of examining the network)
<sadmac> samjam: ....yes. That sort of feature would be far beyond the scope of upstart.
<sadmac> samjam: you could certainly emit events based on whatever though.
<samjam> but what I really want is a config way to add extra trigger dependancies to existing upstart jobs
<sadmac> Keybuk: oh fun
<samjam> so I dont have to keep editing the uipstart file everytime I upgrade
<sadmac> samjam: start on starting ...
<samjam> ah, so I start when autofs is starting
<samjam> and can I stop autofs from starting?
<samjam> (I haven't found any detailed up too date docs even on the ubuntu upstart wiki)
<sadmac> samjam: yes.
<samjam> thanks sadmac, is there a hint or example I can read?
<sadmac> samjam: man 5 init, or whatever scripts shipped with your distro
<samjam> cool, I was doing man upstart
<samjam> thanks
<samjam> sadmac, so the man page doesn't explain how a job that starts on something else starting can make it abort instead; do I just "stop autofs" which prevents it from starting?
<sadmac> samjam: if the job fails to start autofs should not start
<samjam> ah, so I just make my job fail
<sadmac> yes
<samjam> great, thanks
<dekroning> hi
<dekroning> i've got a touchscreen driver that needs to be loaded before Xorg is started, how can i make sure this driver is fully loaded before upstart launches GDM ?
<sadmac> dekroning: depends on how your distro launches gdm
<dekroning> sadmac: ok
<dekroning> sadmac: i'll have to figure out how ubuntu 10.04 does this then
<sadmac> dekroning: but in general loading the driver in a job with start on starting gdm-job will do it, where gdm-job is prefdm on fedora and something else on ubuntu
<ion> :-D https://groups.google.com/group/comp.lang.c/msg/e105e5d339edec01?pli=1
<sadmac> ion: FLAWLESS VICTORY
#upstart 2010-05-13
* Keybuk changed the topic of #upstart to: Upstart 0.6.6 "No, she's dead, this is her son" | http://upstart.ubuntu.com/ | Upstart Q&A Session Video http://blip.tv/file/3606758 | Convert Server Init scripts to Upstart 0900UTC #ubuntu-uds-cocobolo-2 http://icecast.ubuntu.com:8000/cocobolo-2.ogg.m3u | see http://summit.ubuntu.com/uds-m
<Keybuk> Convert Server Init scripts to Upstart 0900UTC #ubuntu-uds-cocobolo-2 http://icecast.ubuntu.com:8000/cocobolo-2.ogg.m3u
#upstart 2010-05-14
* Keybuk changed the topic of #upstart to: Upstart 0.6.6 "No, she's dead, this is her son" | http://upstart.ubuntu.com/ | Upstart Q&A Session Video http://blip.tv/file/3606758 | Kernel and Upstart 1000UTC #ubuntu-uds-cocobolo-2 http://icecast.ubuntu.com:8000/cocobolo-2.ogg.m3u | see http://summit.ubuntu.com/uds-m
<Keybuk> last day! \o/
* Keybuk changed the topic of #upstart to: Upstart 0.6.6 "No, she's dead, this is her son" | http://upstart.ubuntu.com/ | UDS Videos | Upstart Q&A http://blip.tv/file/3606758 | Desktop & Upstart http://blip.tv/file/3621723
* Keybuk changed the topic of #upstart to: Upstart 0.6.6 "No, she's dead, this is her son" | http://upstart.ubuntu.com/ | UDS Videos | Upstart Q&A http://blip.tv/file/3606758 | Desktop & Upstart http://blip.tv/file/3621723 | Plenary Talk http://blip.tv/file/3622104 (~15 min in)
<ion> keybuk: Woot, a video site you can use without flash and with your video player plugin of choice. Awesome.
<Keybuk> I know, yet people complain that it's h.264
<sadmac> Keybuk: nice shoes
<Keybuk> :D
<Keybuk> which one are you watching?
<sadmac> Keybuk: desktop one, because that one worked for me with streaming
<sadmac> (gstreamer on fedora seems to keep hanging. The traces lead in to pulseaudio. Imagine my surprise.)
<Keybuk> fortunately Lennart is working full time on pulseaudio
<Keybuk> and isn't spending all his time on anything more critical
<ion> :-P
<sadmac> Keybuk: The one thing I've yet to understand is how multiple instances will behave in 1.0
<Keybuk> configs and jobs are separated, and there are rules for how jobs are created from configs
<Keybuk> one of those rules says that for each named state in the "while" clause, a job is created
<Keybuk> so if you have a state with two instances
<Keybuk> then you also have two instances of everything that is running in that state
<Keybuk> so it's recursive
<Keybuk> (with an "any" semantic)
<Keybuk> multi-instance states are created automatically for things like devices, files, etc.
<sadmac> so if you have while a and b, and you have two of a and two of b, you'd get 4 of that job?
<Keybuk> err, you would have two
<Keybuk> sorry, misread
<Keybuk> if there's two a, and two b
<Keybuk> you'd get four, yes
<Keybuk> one for a1 and b1
<Keybuk> one for a1 and b2
<Keybuk> one for a2 and b1
<Keybuk> one for a2 and b2
<Keybuk> consider "a" being users, and "b" being user sessions
<Keybuk> or "a" being network devices, and "b" being users
<sadmac> the first one of those is broken
<sadmac> I have an instance of metacity for my user on my neighbor's user session?
<Keybuk> metacity is an application, not a service
<Keybuk> yeah I meant a/b being computers/seats
<Keybuk> been a long week
<sadmac> pulseaudio teh
<sadmac> *then
<Keybuk> right, if a is users, and pulseaudio is while a
<Keybuk> then you get two pulses for two users
<Keybuk> screensaver!
<Keybuk> if a is sessions, and screensaver is while a, you get once screensaver for each
<sadmac> errrgh. I know I can break it, hold on...
<Keybuk> and example
<sadmac> well there's the kludgy case of apache existing for every device in the system if it has while net-device-up
<Keybuk> you have a type of device that needs a program to connect to each one
<Keybuk> and you have multiple users
<Keybuk> so you'd need one for each device for each user
<Keybuk> thus the while/and behaviour
<Keybuk> kludgy case => apache would use "while any network-device" type thing
<Keybuk> so it doesn't matter how many network devices come up
<Keybuk> (it may be that "any" is default and "each" requires stanza)
<Keybuk> so while network-device
<Keybuk> foreach a and foreach b
<Keybuk> that's just arguing sugar vs. hcfs
<barefoot> how can I fix "The script you are attempting to invoke has been converted to an Upstart job, but lsb-header is not supported for Upstart jobs." ?
<Keybuk> hfcs even
<Keybuk> barefoot: upstart jobs can have lsb headers
<Keybuk> indeed, for the case of a distribution migrating from one to the other, it's probably a good idea
<Keybuk> if the upstart jobs obey runlevel behaviour
<sadmac> Keybuk: the any stanza solves it for me.
<Keybuk> sadmac: I'm still not sure which I like better
<sadmac> Keybuk: either one solves the issue. As long as there's the distinction and the explicitness.
<Keybuk> right
<ion> I was thinking about the semantics of something like âtask, on tree-changed /foo/bar and every 5 minutesâ; how about this: each time either event occurs, it sets a flag true for the event in question in the jobâs âonâ tree, and whenever the job is in the stopped state the next time, if the tree evaluates to true, the flags are zeroed and the job is started. So, whenever both events happen again after the job was started the last time, the job will be ...
<ion> ... started again. If the job is already running, it will be restarted whenever it stops.
<Keybuk> makes some amount of sense
<Keybuk> kinda watershedy
<barefoot> Keybuk: hmm, k, guess ill look at the docs and write a new conf for /etc/init for this
<ion> Indeed, watershed was exactly what i was thinking of, but combined with the support for boolean operators. âon tree-changed /foo/bar or tree-changed /foo/bazâ: if either path changes after the job was started the last time, the âonâ tree will evaluate to TRUE and the job will be started whenever it is in the stopped state.
<Md> Keybuk: do you have plans to implement the "open the daemon's listening socket" stuff in upstart?
<Keybuk> Md: yes, same plans I've always had
<Md> cool. for me it's the major selling point of systemd, and I expect that many other believe the same
<Keybuk> yeah, but it's broken if you *just* do it that way
<Md> how do you plan to do it?
<Keybuk> Apple only get away with it because they control the entire stack
<Keybuk> so can avoid the circular dependencies
<Keybuk> Linux has *hundreds* of circular dependencies
<Keybuk> and you end up with three or more processes blocking on each other
<Keybuk> and since the init system knows nothing about them, it can't do anything about it
<Md> do you have some examples?
<Keybuk> I think the one I hit when I tried to boot Ubuntu with launchd pre-Upstart was NM, D-Bus, HAL, dhclient, wpasupplicant and the dhcdbd thing
<Keybuk> they ended up wedged
<Keybuk> but there's plenty
<Keybuk> the how:
<Keybuk> a config will be able to specify ports/sockets/etc. to listen on
<Keybuk> these will be combined with the "while"
<Keybuk> so the socket only exists once the while is true (rather than always)
<Keybuk> on connection, start the service, pass the socket
<Keybuk> usual expectation
<Keybuk> ignore the socket while the service is running
<Keybuk> but most interesting, this can also be combined with other upstart events
<Md> does this still allow starting daemons on demand?
<Keybuk> like start a service when the system is idle on boot, or on initial connection (whichever comes first)
<Keybuk> yes
<Keybuk> you can still have a service that only has a "listen"
<Keybuk> or have a service with only "while"
<Md> do you already have a timeframe for implementing this?
<Keybuk> but both is supported too
<Keybuk> yes, next 6 months
<Md> BTW, a problem I have found with systemd and which I am not sure Lennart is ready to solve is daemons which need to bind to a specific IP/interface
<Keybuk> oh, and also, upstart will support things like "not when on battery"
<Keybuk> and "not when the system load is high"
<Keybuk> and "not when we need to conserve power"
<Keybuk> which get very nice when combined with on demand things
<Keybuk> so you won't be able to on-demand start something if it's inhibited because the system is low on power, or doing updates, etc.
<Keybuk> Md: right :)  I'd planned to do that out of the box
<Md> how?
<Keybuk> Upstart gets an event when the network comes up ;)
<Keybuk> it can use those itself; in this case to begin listening on that IP
<Keybuk> when the IP concerned goes down, it would stop
<Md> does it now? I remember we discussed this and I planned to write a child daemon to do it but I never even checked out the source...
<Md> "when the IP concerned goes down, it would stop" is tricky because in some situations you want to move an IP address between different interfaces (e.g. wired/wireless) and not kill the daemon
<sadmac> if NetworkManager consumes everything, it could signal those states safely
 * sadmac is now wearing a complete Stig costume which arrived in the mail a few minutes ago
<ion> Note to self: talk to Keybuk about ssh-agent: you donât actually need to get environment variables from ssh-agentâs output and inject them into the user session. Just do
<ion> while user
<ion> env SSH_AUTH_SOCK=/var/run/ssh-agent/$USER/agent
<ion> exec ssh-agent -a "$SSH_AUTH_SOCK"
<ion> He probably has figured this already, but anyhoo
<ion> while-around user, actually, for the lack of a better stanza. :-P
#upstart 2010-05-15
<gregcoit> how can I force /etc/rc4.d/S99* to wait for S98 scripts to finish before firing off on boot (lucid server)?
<gregcoit> or is there another way I can keep mysql from starting before rc.local is finished?
 * LowRider Brand New!Notebooks and LCD TVs.Discounts up to 30%. The newest electronics only http://www.elplace.com/
<ion> keybuk: As for ssh-agent, thereâs no need to have functionality for letting it inject environment variables to jobs. Just have something like
<ion> while user
<ion> env SSH_AUTH_SOCK=/var/run/ssh-agent/$USER/agent
<ion> exec ssh-agent -a "$SSH_AUTH_SOCK"
<Keybuk> right
<ion> while-around user, that is (for the lack of a better name for the stanza)
<gregcoit_afk> how can I force /etc/rc4.d/S99* to wait for S98 scripts to finish before firing off on boot (lucid server)?
 * Sergeo22 Discounts!! Our Special Limited Time Offers Up To May,22!!!New BranD!! Notebooks,Plasma and LCD TV's.Buy your electronic needs at our unique prices. Laptop Sony VAIOÂ® VGN-FW590FFD-575,57$!!!Apple MacBookÂ® Air MC234LL/A-695,27$!!! http://www.elplace.com/
<ion> Le sigh
#upstart 2010-05-16
<dkam> Hey guys - I'm trying to get a service to restart on an event - there doesn't seem to be a "restart" stanza though. What's the correct way to request a service is restarted? 
<wirr> hi there... can give me some hints on how to write upstart scripts capable of waiting for user input?
<wirr> I'm trying to run cryptsetup on maemo (which uses upstart) but the password prompt is never displayed and the scripts dive into background
<rockhound> hello ... I would like to convert an init script to an upstart job ... how can I make sure that my script is started before a certain other job?
<rockhound> if this is the wrong chat to ask such a question, please advise .. thx in advance
<ion> Currently: âstart on starting otherjobâ. It will block the starting of otherjob until your job has been started.
<rockhound> ion: perfect ... thx
#upstart 2011-05-09
<Keybuk> ion: I continually rediscover just how awesome your fsck solution was for mountall
<ion> heh
#upstart 2011-05-10
<dcorbin_work> Does upstart write the service PIDs somewhere?
<ion> No, but you can inquire about them with initctl status.
<dcorbin_work> ion: right. status is showing it as not running, but ps says otherwise.
<ion> Then init is not tracking it. Try telling your main process not to daemonize.
<dcorbin_work> I'll see if I can figure out how. Thanks
#upstart 2011-05-11
<djszapi> does "initctl" run only a job (/etc/init/*.conf file), right ?
<djszapi> fex.: initctl stop xsession/conndlgs
<djszapi> hi Keybuk
<djszapi> what is up
<Keybuk> hey
<Keybuk> I missed the shuttle to work this morning, fail
<djszapi> there is also a day tomorrow =)
<djszapi> meego dropped the upstart iirc (Intel)
<djszapi> unexpected turn.
<Keybuk> yeah, I spoke with Arjan about that a year ago
<Keybuk> was entirely expected for me
<djszapi> haha xD
<Keybuk> of course, Nokia dropped meego, so it's kinda irrelevant ;)
 * djszapi has never understood the goal of the meego project, maemo has just worked fine...
<Keybuk> maemo and meego are the same project
<djszapi> not really, no.
<djszapi> we still use upstart in maemo 6.
<Keybuk> yeah, it's just the merging of maemo and mobiln
<djszapi> yeah in the dream worlds :)
<djszapi> from what I can say is that thingy, the maemo and meego security is completely different, no shared bit...
<djszapi> also, meego -> qml, maemo -> libmeegotouch etc.
<Keybuk> sure
<djszapi> the point is that I am happy with maemo, I do not think there was a business reason for meego
<Keybuk> the business reason was to have insurance
<Keybuk> there might not have been an engineering reason
<Keybuk> but engineering reasons and business reasons rarely coincide
<djszapi> insurance can be bought somewhere else :p
<djszapi> what kind of insurance, btw ?
<ion> < ion> Last night i dreamed walking along a path. I saw the code âclass Burn a where burn :: a â aâ. Then i saw the code âinstance Burn Humanâ and people in various stages of dying (with a grotesque horror movie -style appearance) were walking on the path. Everyone of them was smoldering and coughing black smoke.
<djszapi> Keybuk: and how do you enjoy the US, btw ? :)
<Keybuk> insurance, I mean Nokia poured a massive amount of money into maemo on their own
<Keybuk> they needed partners to bear the burden of it
<crass> I'm having a problem where stop/start is hanging for an upstart job (libvirt-bin) on ubuntu
<crass> using strace, I can see that the /com/ubuntu/upstart is connected to
<crass> * the domain socket with path
<Keybuk> is stop/start hanging or blocking?
<crass> its blocking on poll
<crass> which is only polling on the socket
<crass> it does an AUTH EXTERNAL and gets a response, then does BEGIN and writes what is probably some binary data
<crass> looks like that binary data is probably a GetJobByName call, and gets a response, then sends a Start, where it blocks on poll
<crass> is there some way to get logs for upstart?
<Keybuk> sure, initctl log-priority info
<Keybuk> and read syslog
<Keybuk> so right, start/stop are just blocking
<Keybuk> this means that libvirt-bin isn't ever in running or waiting
<crass> Keybuk: so possibly the libvirt script is doing something where its not completing?
<crass> is there a way to restart the upstart/init process?
<radix> crass: is this only happening on libvirt for you?
<radix> I'm having pretty similar behavior for pretty much everything on my vserver guest
<crass> actually, its now happening for upstart-udev-bridge, which I thought was the problem originally so I mucked with it and now it has the same behavior
<radix> like, I can't even restart cron
<radix> (as a very simple example)
<crass> I'm wondering if the internal state of upstart is messed up and needs to be restarted
<crass> radix: yeah upstart-udev-bridge stopped, started, stopped and now won't start, though I can manually start it
<crass> hmm, maybe the cause is because of the "expect daemon"
<crass> I modified the job to not daemonize, but left that, and now I've modified it back, but that didn't fix it
<crass> maybe its still waiting on the original process to fork again? though it should be dead
<Keybuk> yes, that's likely
<crass> Keybuk: should "kill -9 1" restart upstart?
<Keybuk> no
<crass> is there any way to restart upstart without rebooting?
<Keybuk> no
<crass> is that a limitation of the kernel init process?
<Keybuk> no, a limitation of upstart
<Keybuk> though if it did support restarting, it would be restarting-with-state
<Keybuk> which is what you think is broken ;)
<Keybuk> so the restarted copy would have the same state as the old one
#upstart 2011-05-12
<crass> if I use a script block, which runs a program that daemonizes, what expect statement should I use? I think there's a problem with using "expect daemon"
<crass> ok, figured out my problem, the solution was to not have an expect statement and not have the program daemonize
#upstart 2011-05-13
<twb> On a lucid server, suppose I have an upstart job which has "post-stop exec sleep 10m"
<twb> When I try to shut down or reboot the server, will it wait for those 10m, or will the halt/reboot happen before then?
<twb> I want the former -- the post-stop script is actually a patch to libvirt-bin.conf to make it gracefully shut down VMs: http://paste.debian.net/116806/
<twb> AFAICT the latter is currently the case
<twb> Hmm, can I just patch rc.conf to say
<twb> start on (runlevel [12345] or (runlevel [06] and stopped libvirt-bin)) ?
<twb> That seems to work
<twb> Ridiculously ugly, but it works
<twb> OK, so apparently the line I pasted is wrong, because I get a tokenization error
<wraiden> hello
#upstart 2011-05-15
<eguest309> hello guys.good morning,afternoon etc. needed some  help on some issues.
<eguest309> i was wondering if upstart is supported by redheart 5.6
<eguest309> hello
<eguest309> hello
#upstart 2012-05-07
<djszapi> JanC: you mentioned last time upstart runs with sh -e when I asked about my post inst script, but what has that to do with upstart ?
<djszapi> it is just a simple maintainer script.
<djszapi> JanC: this is my post install script: http://paste.kde.org/470960/
<djszapi> JanC: actually, stop foobar || true even hangs the package installation :(
<djszapi> http://paste.kde.org/470996/
<djszapi> is there a simple way of checking if the job runs at all, and only if running, stop that instance before starting a new one ?
<warreng> so.... i feel like it's incredibly hard to run a script as a non-root user from a specific directory (cwd)... 
<warreng> am i missing something obvious?
<warreng> both su and sudo will return the wrong pid if you try to do a "cd" as part of the command...
<warreng> expects fork/daemon don't work correctly at all... etc
<warreng> i'm using upstart 1.3...
#upstart 2012-05-09
<geofft> So I'm trying to run upstart in an schroot on a non-upstart (Debian) system 
<geofft> is there a documented right way to make this work? 
<geofft> well s/documented/recommended/ 
<geofft> should I be using LXC or somesuch to force this into being pid 1? 
<jsonperl> im trying to run upstart on debian, just uninstalled sysvinit and installed upstart and seems to work fine
<jsonperl> but i can seem to tell my script to run only after the network is up
<jsonperl> "start on local-filesystems and net-device-up IFACE!=lo" doesn't seem to work
<jsonperl> im assuming because networking etcâ¦ are all controlled by old sysv init scripts
<jsonperl> any suggestions?
<jsonperl> anyone?
<jsonperl> anyone around?
<jsonperl> trying to figure out a debian / upstart boot issue
#upstart 2012-05-11
<nirvdrum> Hi.  I'm trying to start up a job using setuid, but I need that to work as if it were a login shell.  I.e., I need the unprivileged user's environment setup through the files in /etc/profile.d/  Is that doable?
<mattbillenstein> hi all
<mattbillenstein> how do I clear the state for a stuck job?
<mattbillenstein> status says my job is start/killed with a pid
<mattbillenstein> but that pid doesn't exist
<mattbillenstein> so stop just hangs
<mattbillenstein> and start thinks it's already running
<mattbillenstein> like, does upstart store this state somewhere?
<mattbillenstein> anyone around?
<etank> i am having an issue with the order that daemons are starting in 12.04 i think
<etank> we use nis + autofs and i think that ypbind is trying to start before network-manager is up
<etank> ypbind shows that it is running after a boot but ypwhich says "Can't communicate with ypbind"
<etank> autofs is also running and it shows a pid
<etank> ypbind however does not list a pid
<etank> the only thing i can do to get the system working after a boot is to issue a "service ypbind restart; service autofs restart"
<etank> is there a more upstart'ish way of doing this so i dont have to do it manually or add a sleep to rc.local?
<JanC> etank: are ypbind & autofs upstart jobs or sysvinit scripts?
<JanC> seems like they are sysvinit scripts?
<etank> they are upstart jobs it seems
<etank> they link to /lib/init/upstart-job
<etank> they being start-ypbind, ypbind, network-manager  and autofs
<JanC> if there is an /etc/init/autofs etc. then they are upstart jobs indeed
<etank> there are
<etank> it seems that ypbind is starting too soon
<etank> network seems to not be up when ypbind is trying to start
<etank> should be network-manager -> ypbind -> autofs
<JanC> network-manager being started doesn't mean network is up
<JanC> there are events when network comes up though
<JanC> net-device-up
<etank> ok
<etank> upstart is all new to me
<JanC> so I guess those upstart jobs should wait for those events
<etank> net-device-up needs to happen for non loop back interfaces
<etank> then ypbind can start since it can contact the ypservers
<etank> then autofs can start since nsswitch says to talk to nis for automounts
<etank> you could substitute ldap in for ypbind for systems that authenticate to ldap i guess but the idea would be the same
<JanC> etank: maybe there are more people in #ubuntu-server who are familiar with this particular type of setup
<etank> network-manager.conf does not have a emit statement for net-device-up
<etank> i will ask in ubuntu-server as welll
<JanC> the "emit" stanza is just documentation anyway
<JanC> and I think the actual events might be emitted by another job or maybe upstart-udev-bridge -- see upstart-events(7) 
<Telenull> Hello everyone. Is there a way to exec as an unprivileged user from an upstart? I've tried a few things that show up on superuser (using su -s and sudo -u, but they all cause it to start as root still). any ideas?
<SpamapS> Telenull: two ways actually :)
<Telenull> :P I ended up getting it working with sudo.
<SpamapS> Telenull: if you have upstart 1.5 (Ubuntu 12.04 basically) then you can use 'setuid' and 'setgid' as keywords
<Telenull> oh neat.
<SpamapS> Telenull: otherwise sudo or start-stop-daemon work
<Telenull> unfortunately i'm still on 10.04.
<Telenull> the update to 12.04 will happen for me in about three months.
<SpamapS> Telenull: there are some ideas in http://upstart.ubuntu.com/cookbook/
<Telenull> Thanks for the info though!
<Telenull> Awesome, thanks.
<wookienz> morning any knowledgeable folk around?
#upstart 2012-05-12
<SpamapS> wookienz: sure, whats up?
<wookienz> sorry busy with hobby #2. I am trying to write an upstart job for pyload. The /init.d/ script works fine, but not he /init/ one im writing. ill paste bin what i have. Need heklp trouble shooting why it isnt working
<wookienz> SpamapS, 
<wookienz> http://pastebin.com/iv6kwVr3
<SpamapS> wookienz: ok, problem #1 is that there is no space between runlevel and [2345] ... that means "an event named runlevel[2345]" which is an event that will never be emitted. :)
<SpamapS> wookienz: also if the '--daemon' argument is meant for pyLoadCore, that is probably going to require you to specify 'expect fork' or 'expect daemon'. You can verify which one by running 'strace -e trace=process -f ...' with ... being the command line. If you see one new process, that is 'expect fork', and if you see two, that is 'expect daemon'.
<wookienz> SpamapS, legend. thanks.
<wookienz> from all the gobble-d-gook, i wonder if it is two or one!
#upstart 2013-05-06
<gansbrest> I need to run couple commands on system shutdown, how can I trigger upstart script to run on shutdown / reboot?
<SpamapS> gansbrest: start on runlevel [06] if you want it to run in parallel with shutdown...
<SpamapS> gansbrest: start on starting rc RUNLEVEL=[06][newline]task to have it block shutdown until it is done
<gansbrest> if I run it on starting rc - will it run only on shutdown or on boot as well?
<SpamapS> gansbrest: RUNLEVE=[06] means "on shutdown and reboot"
<gansbrest> I see, so start on starting rc RUNLEVEL=[06] ( no need for AND between those? )
<SpamapS> gansbrest: no, its not an AND, it is a filter
<SpamapS> gansbrest: RUNLEVEL != runlevel
<SpamapS> a bit confusing I know
<gansbrest> I see, thanks a lot
<SpamapS> gansbrest: 'starting rc' is the event, RUNLEVEL=[06] makes it only match if those environment vars match
<gansbrest> one more question, I need to execute multiple commands on stop, and I'm doing it like this 
<gansbrest> task
<gansbrest> exec cmd1
<gansbrest> exec cmd2
<gansbrest> but only cmd2 gets executed?
<gansbrest> (basically I'm calling same command but with different options )
<gansbrest> exec /usr/bin/knife node delete
<gansbrest> exec /usr/bin/knife node delete
<gansbrest> exec /usr/bin/knife client delete
<gansbrest> ----------------
<gansbrest> created simple example which illustrates the problem
<gansbrest> task
<gansbrest> exec echo "YOOO" > /tmp/y 2>&1
<gansbrest> exec echo "MUUU" > /tmp/m 2>&1
<gansbrest> will execute only MUUU
<gansbrest> and I need both of them
<SpamapS> gansbrest: you want 'script\nput stuff here\nend script'
<gansbrest> yes, but it seems like when I use script the process keeps going
<gansbrest> where with task it waits for process to finish
<gansbrest> I ended up moving my commands to a separate script
<gansbrest> and execute just that one script
<SpamapS> gansbrest: should be identical
<SpamapS> gansbrest: script spawns /bin/sh and pipes the rest into it. with task, the 'start on' events will block until that /bin/sh exits
#upstart 2013-05-08
<daguz> have I read the entire manual cover to cover? no.  Am I going to ask anyway? yes.  :)  
<daguz> How do I start/stop a job as user "me"  without using sudo
<daguz> in the script I have this:     exec start-stop-daemon --start -c me:me --exec  /usr/local/bin/bus-node.sh 
<daguz> i want root or me to start/stop this job and it always be run as me.
<stgraber> always run as me => setuid me + setgid me
<stgraber> root or me to start/stop => I think you'll need sudo for that or possibly some clever policykit magic
<daguz> i thought I tried it such that the sudo was called from the upstart script, such that the user could call start/stop and essentially sudo to themselves while root always has that ability...  maybe I got something else wrong..   
<dypsilon> Hello everyone. I'have bunch of upstart scripts and a debian squeeze system with system v. Is can't fully replace system v, is it possible to install upstart alongside system v and use it just for those scripts?
<SpamapS> dypsilon: upstart still runs sysvinit scripts
<SpamapS> dypsilon: not sure how well it works on Debian though
<dypsilon> SpamapS, I can't afford to migrate everything to upstart right now.
<SpamapS> dypsilon: nobody can, or ever will :)
<SpamapS> dypsilon: the idea is to migrate the things which hold back system boot speed or which need to be coordinated with those things.
<dypsilon> SpamapS, I don't really care about boot speed. The perfect solution for me would be to just run upstart as a system v service and alongside system v.
<dypsilon> Just reuse the scripts I already have. But I can understand if that's not possible.
<SpamapS> dypsilon: why?
<SpamapS> whats the point of upstart if it is not pid 1?
<dypsilon> SpamapS, it's a great plattform for controlling processes, I suppose.
<dypsilon> I have some scripts I want to reuse, also there are some very usefull scripts on the internet.
<dypsilon> Also I will be able to ease into pid 1 upstart in the future without having to introduce something like daemontools
<dypsilon> for the time beeing
<SpamapS> dypsilon: ok, I'm convinced. You'll have to code that though. ;)
<dypsilon> SpamapS, :)
<dypsilon> SpamapS, so it's not possible right now, ... thank you
#upstart 2013-05-09
<mmarker> Hmm, if I had a question related to using upstart to do something as it's set up for Ubuntu, is this the right place to ask, or is this really a devel only channel?
<SpamapS> mmarker: yes ask away
<mmarker> Ok, simple enough. Have a Beagleboard xM that's running Precise. I want an upstart job that'll run after the rc scripts are finished running. I tried triggering my task on "started rc", but that's not quite right (rc is running, I want it when things are done)
<mmarker> If I read the cookbook correctly, I should have an rc script that runs last that should throw an event via initctl emit...is that right?
<SpamapS> mmarker: stopped rc
<SpamapS> mmarker: you probably want 'start on stopped rc RUNLEVEL=[2345]'
<mmarker> Hmm, I'll need to try that
<mmarker> that does make sense, since rc isn;t something that keeps running. Thanks!
#upstart 2013-05-11
<rawtaz> hi!
<rawtaz> question: i am writing a conf for a third paty script which in turn starts a daemon. but it doesnt return a PID so i need to make a post-start script that grabs the pid. i can do that, but how should i hand the resolved PID of the final process to upstart so that it can keep track of things? should i e.g. put it in a file (pidfile maybe), and/or should i set a variable in the upstart conf, or something else?
<rawtaz> not having very much success with this. i need to tell whatever upstart is which pid the executed process has. how can i do that?
<rawtaz> so it tracks the right pid
<JanC_test> rawtaz, maybe use start-stop-daemon  (you can't hand over the pid to upstart right now)
<SpamapS> rawtaz: There are only two options. Either you make the process not "daemonize" (usually "foreground mode" in the options), or you carefully count the number of times it forks before being a daemon, and use 'expect fork' or 'expect daemon'.
<SpamapS> rawtaz: a third option is to run the program in post-start, and in post-stop, you use the pidfile to kill it. THis means upstart does not keep track of the pid and can't do things like respawn.
<rawtaz> JanC_test: start-stop-daemon is an ubuntu thing i believe :)
<rawtaz> SpamapS: oh, didnt know about foreground mode, gonna check it out
<rawtaz> SpamapS: yeah, but for some impossible-to-understand reason there's only two levels of forking supported. to me thats a big wtf but i guess it's the way it is
<rawtaz> SpamapS: doing your third suggestion is what i ended up with, found a post on SO as well. having some trouble with it not binding correctly but that shouldnt be due to upstart :)
<rawtaz> so i think it's okay. i guess this means upstart doesnt track the pid and have no control over the process, but thats fine i think, its not that important
<rawtaz> thanks a lot for your help guys :)
<SpamapS> rawtaz: np, and agreed, that is silly and they should fix it
<SpamapS> rawtaz: or, if you feel like you might know enough C, you could of course fix it yourself :)
<rawtaz> i could, if i did :D
#upstart 2014-05-06
<Trevinho> Hi, we've a problem when trying to run unity with upstart at session level.... The fact is that it doesn't, *weirdly* seem to inherit some env variables that are set when gnome-session launches the autostart programs (such as gnome-keyring-daemon)
<Trevinho> Basically, what happens is that both unity and unity-settings-daemon are launched "on starting gnome-session", but once all it's loaded
<Trevinho> if I open a terminal from unity, then these env variables are not set (env | grep key should show you the one I mean)
<Trevinho> instead, if I do ctrl+alt+t (which causes unity to make unity-settings-daemon to open a terminal), then these are set correctly
<Trevinho> And the werid thing is that both processess seems (after some debugging) to be launched just before gome-session... But unity doesn't get all the env varialbes it should
<Trevinho> also, gnome session has a dbus call to set/unset env variables and I was wondering if I should bind these calls to set the envs also at upstart level, but they don't seem to be set globally... I mean, not in the terminals I have opened at least
<jodh> Trevinho: have you compared 'env' with 'initctl list-env'? The session init will by default inherit all variables from the environment that started it and job will be given that environment, plus any variables set with 'initctl set-env key=value' so it may be you need to adjust the time particular jobs start to ensure that any 'initctl set-env's happen before gnome starts autostarting .desktop apps.
<Trevinho> jodh: well I've tried to launch unity after that gnome-session has set these variables, but then at that point these variables are not set at all (while if I make it launch before they only are set "partially")...
<Trevinho> jodh: but still I'm wondering why a process that starts before it (unity-settings-daemon) will inherit it, while unity doesn't
<jodh> Trevinho: I'm confused. Are you saying gnome-session.conf is calling 'initctl set-env'? If it is, does 'initctl list-env' from any terminal show that the vars were set? Might be easier if you raise a bug with just the basic issue as I'm getting confused by all the unity and gnome stuff I'm afraid :-
<Trevinho> jodh: no, gnome-session is not calling that.... Gnome-session runs some autostart scripts that then set env variables
<jodh> Trevinho: how are they setting env vars exactly?
<Trevinho> jodh: I've not checked the internals yet, but there's a gnome-session dbus call for doing that, and I guess that when it's done, gnome-session sets these envs at its level, at that point all the apps it has launched will use them
<Trevinho> jodh: btw explaing this is probablty harder than seeing it.
<Trevinho> jodh: you can easily test this by:
<Trevinho>  sudo sed "s/compiz;//" -i /usr/share/gnome-session/sessions/ubuntu.session
<Trevinho> jodh: then if you reload your unity session, you will see that if you use ctrl+alt+t launches a terminal with different env than if you run it from unity launcher/dash
<jodh> Trevinho: I'm struggling to see how this is an upstart issue if gnome-session's autostarted apps are making env setting dbus calls on gnome-session?
<Trevinho> jodh: I'm not saying it's an upstart issue :), I'm just wondering how I can fix this, since we'd like to use upstart to launch unity for multple reasons, but currently we can't do it as it would break the gnome-keyring-daemon env vars
<jodh> Trevinho: might be a question for the desktop team then as they understand the gnome stack more than I do :) How about raising a bug and assigning to upstart + gnome for discussion?
<Trevinho> jodh: ok
<xnox> Trevinho: with unity, I thought "unity-session" is supposed to be used, not gnome-session.
<xnox> Trevinho: also we are working on a fix to get gnome-keyring agents to be spawned correct under upstart and have their environmental variables available everywhere.
<Trevinho> xnox: no, we use gnome-session with a unity profile
<jodh> Trevinho: I really think this discussion should be on #ubuntu-desktop.
<Trevinho> jodh: ok
<jose> hey, everyone! I'm doing 'setuid username' (with a valid username on the system) for an upstart job and it says '/proc/self/fd/9: 2: /proc/self/fd/9: setuid: not found'
<jose> any idea on what may be happening?
<jose> found the error, thanks!
#upstart 2014-05-09
<menace> when i define a job like in http://pastebin.com/3ziQgxBT for shutdown (it works only for shutdown, which is intended), does this block, even if that script operation takes longer?
<menace> in the t1.sh script i did atm only a touch, but i want to run a service over the fs...
<menace> and if that does not block, the thing will not be completed, since it will take some time...
<menace> or should i rather use a pre-start script?
<xnox> menace: you have some time, but eventually after timeouts it will be killed.
<xnox> menace: what is that command doing?
<menace> scanning java libraries for viruses... stupid enterprise requirement >.<
<xnox> menace: are you sure you can't do it earlier? this has potential to hold up files open on the filesystem, thus corrupting and requiring recovery on boot.
<xnox> menace: if that is quick, than it should be fine. Otherwise, it's best to use cron to execute that. or user-session job instead, which can execute on logout for example.
<menace> if you can say a appropriate signal on upstart or dbus, which i could use? i have no idea which to use.. and upstart was rather easy to get
<menace> ah, user-session job, okay, i'll try that
<menace> a question: if my user-session-job is not complete, will the upstart system halt, until it is, or will it just shutdown?
<xnox> menace: there is maximum delay, after which all processes are killed and system is shutdown.
<xnox> menace: if you wish to inhibit shutdown, see dbus apis to notify about that.
<xnox> i'm not sure, but it's something in gnomish* fredesktopish* things.
<menace> this seems like a complex issue o_O
<menace> at least, because i want the script started, if the user triggered shutdown, i then want to stop it and scan the directory
<menace> well.. since my target platform does not have systemd/logind (which is the inhibit thingie)... is there a configuration possibility to extend the upstart maximum delay? *desperated*
<menace> preferably without recompiling upstart? <.<
#upstart 2015-05-05
<gahan> I'm not exactly sure what doesn't work, however lightdm's x-0-greeter.log is populated with what looks like to me error messages regarding upstart: indicator-{secret-agent,bluetooth,application,messages,datetime,session,power,datetime} are respawning and eventually get a TERM. Meanwhile unity-settings-daemon spits out WARNINGs: Xsync found version 3.1 error base 134 event base 83, GDBus.Error:org.freedesktop.DBus.Error.UnknownMethod:RegisterClient, "Name taken or b
<gahan> (Vivid)
#upstart 2015-05-06
<athan> Hello everyone - is there a way to refresh upstart so it can see my new service I've added to `/etc/init/foo.conf`?
<Swifftynob> hey i think i have an upstart problem, i have a program i wrote that uses upstart to run, there is a section of this program i made that runs a bash script. when it executes the bash script, the bash script doesnt seem to have access to the same enviromental variables as it would if i was not using upstart
<Swifftynob> so if i run my program without upstart, it has no problem executing the bash script call within the program but with upstart it is unable to 
<Swifftynob> is there a user or enviroment setting or something i can set in the upstart init file?
<Swifftynob> nvm found a shitty work around
<shafjac_> dumb question -- in ubuntu 14.04, if i have both an /etc/init.d/script an an /etc/init/script on my machine, which is executed when i start/restart with the 'service' command?
#upstart 2015-05-08
<astrumas> Hello, i have a system that is using upstart 1.5.  I have a "master" job that launches a bunch of smaller, more specific jobs. I have a generic configuration file for the children so when I start the job it looks something like: "start <job> JOB_NUMBER=2 NAME=some_worker SCRIPT_PATH=/path/to/script/child/runs"
<astrumas> However, I have recently run into a problem where I need to change the user that a child job is run as... so im looking at the "setuid" option.
<astrumas> But it appears that if I use something like "setuid ${JOB_USER}", it doesn't expand the variable correctly, but it does for the rest of the file.
<astrumas> Is setuid not able to use variables by design? Am I doing something wrong?
<solidsnack> We're running a program under Upstart that has a HUP and TERM hand handler, but when we call `reload program` the HUP handler doesn't seem to be called.
<solidsnack> It turns out that if a shell script is `wait()`ing then it doesn't respond to HUP.
#upstart 2016-05-10
<frew> does anyone know if there is a way to detect a restart?  That is, I would like to run a command when a service is restarted automatically, but not when it is started via stop then start
<frew> I sorta expect the start on reason or something to be in an env var?
<chras> frew: yeah
<chras> you can do this
<chras> sec, lemme look for my code which does this
<frew> awesome, thanks
<frew> oh is it UPSTART_EVENTS ?
 * frew *just* found http://upstart.ubuntu.com/cookbook/#standard-environment-variables
 * frew would guess a "respawn" in UPSTART_EVENTS means it crashed
<chras> yeah you can check on that
<chras> so when you do an initctl restart you want another event to fire?
<chras> or when you kill the running process, and upstart restarts it automatically
<chras> or both?
<frew> no, really all I want, if possible, is that if it crashes (or if I killed it directly)
<frew> so the latter (I think)
<frew> basically if it restarted due to a crash
<chras> right, k, so i have an event which does this
<chras> sec lemme pastebin it
<frew> thanks
<chras> https://pastebin.mozilla.org/8870501
<chras> but, when i test it, it doesnt trigger on an initctl restart $process
<frew> which is the goal here.
<frew> huh, so are scripts bash?
<chras> more or less
<chras> with a set -e
<frew> ok
<frew> I assumed they'd be sh
<chras> well my sh is linked to bash
<frew> mine's dash
<chras> i dont use dash
<frew> gotcha.
<chras> dash does ... unexpected things
<frew> heh
<frew> so you install this upstart config
<frew> and it captures basucally all events?
<frew> (hence the JOB!=self_help, which is what this is)
<chras> yeah im having trouble getting it to trigger on a restart though
<frew> restart meaning a crash?
<chras> my thing triggers on a crash
<chras> just not an 'initctl restart'
<frew> ok that's how I want it
<frew> yeah
<frew> that's what I want.
<frew> if someone manually restarts, I think I'm ok with that not being logged especially
<frew> though it would be nice to know as well
<chras> i made this event back when i had heartbeat dying unexpectedly
<chras> and then i had a config file which took actiosn based on what happened
<chras> ie
<chras> heartbeat XCPU echo "nas_self_help: heartbeat died unexpectedly with XCPU Signal, restarting" | wall -n
<chras> so heartbeat was getting a XCPU kill flag for whatever reason (ended up being a bug in heartbeat debug)
<chras> and then id wall it out for instance
<frew> right my thought here is to either page or create an issue or osmething
<frew> not sure
<chras> and it does trigger on a stop / kill / etc
<chras> but not sure about restart atm
<frew> ok well I need to get this installed and I'll see how well it works
<frew> so GCONFIG and PCONFIG (currently) do nothing
<frew> so key signal rest is like
<frew> who did what
<frew> what they did
<frew> and other info?
<frew> or something?
<frew> oh sorry I am reading this and learning more
<frew> I hsould talk to my rubber duck before asking here
<chras> well thoes are just configs that i use
<frew> right
<chras> i can paste thoes in the thing, sec
<frew> thanks that'd be helpful
<chras> https://pastebin.mozilla.org/8870503
<chras> i guess the main thing i wanted you to originally see was the 'start on stopped JOB=${some_job}
<chras> and then have a task which does whatever you want in a script stanza
<frew> right
<frew> well and having a single task that does it is very elegant
<frew> I was gonna have a script I put in all my scripts
<chras> frew: yeah i cant get it working in the context of an 'initctl restart'
<chras> as a workaround you could do an initctl emit in your pre-stop
<chras> yeah a restart never emits a 'stopping' or 'stopped' event
<frew> chras: fwiw the z thing is not really needed anymore iirc
<chras> frew: ug. i got it
<chras> its definately a bug
<frew> yeah
<chras> if you have a pre-stop script
<chras> then the job goes running -> pre-stop -> start
<chras> and never emits a stopping/stopped
<frew> you think the maintainers of upstart would fix it?
<frew> I was telling my boss about this and he was a little hesitant since upstart is destined for the void
<frew> but so is everything so I'm gonna keep going
<chras> if you DONT have a pre-stop script, then it works as intended
<frew> interesting.
<chras> it MIGHT be this bug, https://bugs.launchpad.net/upstart/+bug/703800
<frew> btw logger ~~ syslog?
<frew> I'd say even if it is that bug, that bug is 4y old and will probably never get fixed
<chras> right
<frew> I think I'm gonna make an "ANY" job too.
<frew> at least so I can get started with this reasonably.
<chras> anyways, sorry couldnt be more help
<frew> no way this is great
<frew> you 100% solved my issue and added more
<chras> great
<frew> chras: actually I guess I maybe misunderstand you; I don't get logging or anything for a respawn (crash and restart)
<frew> is that what you were saying is broken?
<chras> hi
<chras> k the quick summary was
<chras> IF you have a pre-stop, then an initctl restart does start -> pre-stop -> start , and skips doing a stopping, or stopped event
<frew> ok that's what I thought you were saying.
<frew> this is neither a start, stop, nor restart, but a service that starts and crashes after about 3s, consistently
<frew> and I get no events
<chras> so your event fails to start at all
<chras> and thats what you're trying to catch ?
<frew> well I mean, it never forks, so as long as upstart knows, it worked correctly for 3s
<frew> and then crashed
<frew> but yes, I'm trying to catch an error causing a respawn, likely a compile error
<chras> right. ok, i think i understand
<frew> though it could have been running for three hours
<chras> so your daemon forks, and upstart isnt detecting that it died?
<frew> it would still be the same situation
<frew> no
<frew> it never forks
<frew> it just exec's
<chras> ah
<frew> hence upstart not knowing it's ready
<chras> does your upstart throw an error like
<chras> main process ($pid) terminated with status $exit?
<frew> if it would place an error in the syslog, no
<frew> not sure where else to look
<chras> check dmesg
<chras> do you 'console log' ?
<frew> I don't know?
<chras> mind putting your event on pastebin?
<frew> yeah it's super basic
<frew> https://gist.github.com/frioux/0e4e4c1dc0b02f82a9a1a327ae55c248
<chras> right k
<chras> i think you want to add a 'console log' to that
<chras> so you can get some minimal logging
<frew> ok
<frew> (fwiw I know why it's crashing, I just want to be able to detect better in the future)
<chras> and you're trying to throw another event when that one fails to start?
<frew> well, I just want to find out, somehow
<frew> originally I was gonna write a pre-start that looked at 
<frew> UPSTART_EVENTS
<frew> and if respawn was in there, do a thing
<frew> but your solution was a lot more elegan
<chras> so, when i do this
<chras> https://pastebin.mozilla.org/8870543
<chras> when my main process ends with a non 0 exit code (which i assume is your failureA)
<chras> it still triggers my self_help
<frew> surely it is
<frew> although... it's probably exiting 255
<frew> any chance upstart ignores high errors?
<chras> should be anything non-zero
<frew> ok
<chras> unless you told it to ignore certain exit codes
<frew> I don't even know how I'd do that?
<frew> where would that be done
<chras> its just a main-config command
<chras> sec
<chras> lemme find it
<chras> http://upstart.ubuntu.com/cookbook/#normal-exit
<frew> well I showed you the whole file
<frew> unless you can glboally do it, I didn't do that
<chras> yeah so itll be non-zero exit codes
<chras> will cause it to fail
<chras> so my self_help event isnt triggering on your thing exiting weirdly?
<frew> correct
<frew> I have to admit though
<chras> does your reaper fork ?
<chras> or is it a foreground process
<frew> I did clean up your self_help thing to be shorter and simpler
<frew> no it doesn't fork
<frew> it's foreground
<frew> lemme paste the changes I made
<chras> did you run an initctl reload-configuration?
<frew> they shouldn't harm anything
<chras> to get the new event
<frew> yes
<chras> does an initctl start self_help work?
<frew> well I get output about other services
<frew> but let's see
<chras> ah interesting so you know it IS working, just not with your reaper?
<frew> oh wait
<frew> wtf
<frew> initctl: Unknown parameter: JOB
<frew> does that mean antyhing to you?
<chras> yeah
<chras> initctl start self_help JOB=test
<chras> thats just the instancing stuff triggering
<chras> normally JOB is emitted automatically by other upstart events
<frew> initctl: Job failed to start
<frew> right
<frew> no obvious reason why it's failing
<chras> hm, pastebin it ?
<frew> the modified self_help or what?
<chras> yea
<frew> k
<frew> https://gist.github.com/frioux/953fe2f4b950c2bef58521f0ca0e0ad9
<frew> should be effectively the same, but work with any POSIX shell (and only allow one extra config file)
<frew> (and I renamed it watchdog)
<chras> right
<chras> you're using dash right?
<frew> I wrote it with dash in mind, since we are moving to dash soon, but it's still bash now (12.04)
<frew> oh no
<chras> its just a syntax error for me
<frew> 12.04 is dash
<frew> oh?
 * frew eyeballs
<chras> ./foo.script: 24: ./foo.script: Syntax error: "(" unexpected (expecting "then")
<frew> I wonder why that's wrong
<frew> it's supposed to work
<frew> `(expression)  True if expression is true.` from dash(1)
<chras> yeah it looks right
<chras> sec, seeing if i can fix
<frew> can repro fwiw
<frew> fwiw the ()'s are not needed, since -o binds more tightly than -a
<frew> but I thoguht it made it easier to read
<frew> dash -c '[ ( -f /bin/dash ) ] && echo 1'
<frew> I think this must be a bug in dash.
<chras> dash does unexpected things :P
<frew> I never claimed it was perfect
<frew> I jsut can't switch what /bin/sh is
<frew> ok I'll just leave out the () for now
<chras> yeah i cant use ()'s in dash for whatever reason
<frew> oh derp
<frew> dash -c '[ \( -f /bin/dash \) ] && echo true'
<frew> gotta escape them for some reason
<frew> must be a history expansion or something.
<frew> nonetheless I do see this: `self_help(pt-heartbeat-update-mysql): caught job[pt-heartbeat-update-mysql] instance[] process[respawn] result[failed] status[] signal[]` in syslog, but nothing about my reaper
<chras> hm
<frew> trying a different route, but 90% sure that upstart is just not creating an event for that
<frew> I don't see where it would in the lifecycle anyway, fwiw
<chras> you can try bumping the debug up with log-priority debug
<chras> and see where its dying
<frew> hm.
<frew> I have a theory.
 * frew "simplifies"
<frew> yeah, it catches start and stop, but not respawn
<chras> respawn, when the main process dies?
<frew> yeah
<frew> respawn is an even that's not real, to be clear
<frew> I thought it might be
<frew> s/even/event
<frew> I sorta thing consuming events won't work for this, since there isn't one for what I'm thinking of
<chras> lemme try here
<chras> k so
<chras> we're triggering self_help/watchdog on the upstart event 'stopped'
<chras> after something is completely stopped
<chras> for it to also hit your respawn, you need to change that to be 'start on stopping ...'
<chras> i should make that change for my own needs as well i guess
<chras> with it only being set to 'stopped'
<chras> it will wait for upstart to give up on respawning before its triggered
<chras> like i suppose, its the difference between if your job fails 10 times in a row, and upstart gives up on it
<chras> getting 10 emails, or 1
<chras> if your watchdog sends email out at least.
<chras> oo, interesting though
<chras> the respawn attempts have a result[ok] instead of a result[failed]
#upstart 2016-05-12
<BrazierCustoms> hi. I am using upstart on a raspberry pi. I have an issue where I need a service to start/stop based on availiblity of a samba share. is this possible?
#upstart 2016-05-13
<dennisdennis> I'm having an issue daemonizing a process, I'm using daemon from /etc/init.d/functions, but when I run service servicename start it just stays in the foreground.  Thoughts on what I should do?
<dennisdennis> prometheus node_exporter for what it's worth
<lnykryn> dennisdennis: deamon function from initscript does not daemonizy the process, it expect that the process will do classic double-fork
<dennisdennis> does start-stop-daemon make the same assumption, I noticed that seems more like a Canonical thing, I'm on centos6 I suspect I can use Upstart, or maybe I can just do $ nohup /path/elf 2>&1 > logfile &
<dennisdennis> What's the advantage of a service not double forking anyway and leaving the exercise up to the user??
<lnykryn> dennisdennis: well I would guess that it is useful only in the case you want to run it from a different service and get notification if it dies
<dennisdennis> as in you want it to be a child of something?  Is this a consideration for running the service in a container, that it should not double fork?
<dennisdennis> or it doesn't really need to
<lnykryn> this is really a difference for the sysvinit word, for new inits like upstart or systemd, there is a small difference
<lnykryn> for example in systemd, the double forking service has the advantage that with end of the original process it can say "now I am running", service without doublefork is considered running immediately after the original command is run
<lnykryn> in sysvinit world the double fork also allows to clean execution envioment for the final process
<dennisdennis> I understand the distinction, thanks for your help
#upstart 2017-05-12
<pakcjo> Hello, I have a script which emits a signal when started and I need to run another one after that, it also requires cups, so I have start on (myevent and started cups) but it doesn't work
