#upstart 2007-09-04
<JK45> hi,
<JK45> does someone know if the functionnality "start on event1 AND event2" is availiable, i am not able to use it 
<mbiebl> JK45: no, it's not implemented yet.
<JK45> erf, ok thanks
<JK45> any idea of the priority of this feature ?
<mbiebl> JK45: please ask Keybuk
#upstart 2007-09-06
<likewise> hello all
#upstart 2008-09-01
<ion_> 2 dl done, 4.5 dl still in the pint, a.k.a. i got around to making some coffee.
<sadmac> ion_: what are we talking about?
<sadmac> also I made malloc segfault
<ion_> sadmac: Whether LHC will prove string theory right or wrong.
<sadmac> ion_: we're all gonna die
<ion_> sadmac: Oh noes
<cmatheson> hi guys, i'm looking to write an upstart .3 job on ubuntu hardy.  i'm having trouble finding documentation that is pre upstart .5--is there any available?
#upstart 2008-09-03
<keram> hello'
<keram> i wanted to add an inittab entry to make sure that a program remains running but found that inittab was replaced by upstart
<keram> i created the directories /etc/init/jobs.d/ and then a job file inside containing "exec foo"
<keram> but sudo start foo returns: "start: Unknown job: foo"
<keram> any ideas how to get this working?
<xyzz> keram move it to /etc/event.d
<sadmac2> Keybuk: anything new of late? Or is everything still waiting for LPC?
<Keybuk> sadmac2: I've been mostly on Leave ;)
<sadmac2> Keybuk: ah. good you're getting some rest.
<sadmac2> http://sunshinejoy.com/Default.asp?Item=95122&Name=Golf_Shirts&Hot=1
<sadmac2> someone told me to wear polo shirts to meetings today (school related, not Red Hat thankfully)\
<sadmac2> I think this is just right.
<sadmac2> It says FUCK OFF just loudly enough without getting me called on it
<sadmac2> notting: did you get my email?
<notting> the bundle? yeah, haven't had a chance to look yet. is that relative to the existing upstart-0.5.0-branch?
<sadmac2> I think its relative to master
<sadmac2> i.e. it contains the entire upstart-0.5.0-branch\
<sadmac2> that's what I was going for anyway
<mbiebl> Is there a way to tell upstart 0.5 to try to reconnect to the system bus?
<mbiebl> If I start dbus-daemon after /sbin/init, there is not upstart service on the system bus.
<mbiebl> Or to rephrase the question: How is the interaction between dbus and upstart supposed to work?
<sadmac2> mbiebl: starting dbus later than init should work
<sadmac2> that's the expected case actually
<mbiebl> sadmac2: hm, doesn't work for me unfortunately.
<sadmac2> hm
<mbiebl> Does dbus need any special configuration besides the Upstart.conf dbus config file
<sadmac2> mbiebl: did you install the /etc/dbus-1 file?
<sadmac2> mbiebl: ^^ :)
<sadmac2> oh, you have that
<mbiebl> yeah
<sadmac2> hmm
<sadmac2> mbiebl: check through the anonymous connections. see if its just not getting the name
<mbiebl> sadmac2: according to d-feet there is no init process on the system bus
<sadmac2> mbiebl: should be com.ubuntu.Upstart
<Keybuk> only if you start D-Bus before Init ;)
<mbiebl> yeah, I figured that from the dbus conf file
<sadmac2> Keybuk: really?
<mbiebl> Keybuk: how is that supposed to work?
<pingveno> Is there something I need to do to have register a new Upstart script?
<ion_> If inotify is working on your system, no.
#upstart 2008-09-04
<keram> xyzz, when i run it with 'sudo start foo' will the process show up when i do ps aux?
<keram> hmm actually, its saying 'start: Unknown job: foo'
<keram> ah nvm i figured it out :]
<saimon> Hi all, I wrote this upstart script (http://pastie.org/265874) which is supposed to start (on reboot) and keep a monitoring daemon running on my system, and respawn it if it's killed. Unfortunately, it's neither started on reboot, nor is it respawning the monitoring daemon. What am I doing wrong?
<saimon> This is the channel for the ubuntu Upstart init daemon right?
<saimon> anyone?
<keram> idont know how to help
<keram> yes
<keram> if you stick around for a few hours (~24) someone will get to your question
<saimon> keram: thanks....
<saimon> 24 hours? That's a high price to pay )
<saimon> :)
<keram> a google search may be cheaper :]
<saimon> keram: I have and am trying thing as we speak but I'm still not there...
<saimon> so I'll hang around a bit
<keram> k
<xyzz> saimon i dont think there is anything wrong with your script
<xyzz> saimon but the service you are bout to start is forking into background after start?
<xyzz> is start yourjob saing anything?
<saimon> xyzz: Well it doesn't seem to work. If I reboot, god isn't started and if I kill -9 it, it isn't respawned either. I've since replaced that with: http://gist.github.com/8777 which I'm trying now. And in answer to your question, yes it forks into the background and 'start myjob' starts it up without complaint.
<xyzz> and thats the reason, upstart cannot monitor your service, it needs to run un foreground (prefered) od use "daemon" in job definition
<saimon> xyzz: ah I see...so setting 'daemon' should do it?
<xyzz> yes
<xyzz> http://upstart.ubuntu.com/wiki/Stanzas
<xyzz> here is little more description
<saimon> xyzz: thanks a lot...trying it now...
<saimon> order is unimportant right?
<saimon> hmm appears I also need to define pid
<xyzz> order doesnt matter, upstart uses declarative DSL
<saimon> ok thx
<xyzz> the best way is to spawn proces in foreground
<saimon> ok can do that too...
<xyzz> and that will probably solve your issue :)
<saimon> many thanks...
#upstart 2008-09-05
 * sadmac2 read the domain in tholme's whois as nextgenital.com
<sadmac2> its nextgentel.com, if anyone has a less noisy IRC client than me
#upstart 2008-09-07
<Chrissss> hello, i've got a little question related on upstart
<Chrissss> is there a way to limit the number where upstart tries to respawn a process?
<Chrissss> in my case i establish a vpn connection via vpnc, since vpnc drops sometime the connection i use upstart to respawn vpnc
<Chrissss> but i noticed that in some cases the connection can't be establised and upstart respawns vpnc over and over again
<tholme_> yes there is
<tholme_> i think...
<tholme_> theres a respawn limit you can use
<Chrissss> ah, just found it...
<Chrissss> respawn limit 10 5
<Chrissss> [...]so we limit itâs respawning to 10 times in 5 seconds (which happens to be the default).
<Chrissss> http://www.netsplit.com/2008/04/19/upstart-05-job-lifetime/
<Chrissss> tholme_, thanks for the push into the right direction, cu
<tholme_> np :)
#upstart 2009-08-31
<Milan-BV> Keybuk: hi
<jMCg> Hi folks.
<jMCg> Wikipedia lists upstarts along with Solaris' SMF, so I was browsing through the feature list and the Wiki, and the bug tracker, but I couldn't find one core feature that SMF has, which I, so far, have failed to find on Linux:
<jMCg> SMF can start a service as a certain user/group giving it a certain set of privileges.
<jMCg> On Linux this would translate to Capabilities, which is Linux' POSIX 1003.1e implementation of that same concept.
<ion> Do you have a question? :-)
<jMCg> Yes!
<jMCg> Is anybody thinking about, or even actively planning to add such a feature to upstart?
<ion> You should ask Keybuk about that when heâs around.
<jMCg> On Solaris I can start a (shitty) Java Application Server as unprivileged user, and have it bind to port 80, which is seriously awesome. It would be even awesomer if I could do that on Linux.
<jMCg> ion: which timezone does he live in?
<ion> If that has not been planned for Upstart, you might very well be able to sell that idea. I would like such functionality for sure, but iâm not the authority on Upstart. :-)
<ion> Heâs British.
<jMCg> https://launchpad.net/~upstart-devel < the only brit I see is scott.
<jMCg> Anyways. Thank you for your time.
<jMCg> I think I should devote mine now to sleep.
<ion> If you do a /whois on Keybuk youâll notice heâs Scott. :-P
#upstart 2009-09-01
<Keybuk> sadmac2: yeah, I'd thought of having a big table for lookups of nih_alloc contexts
<Keybuk> one advantage to that would be the big table could be "pointer" referenced
<Keybuk> so nih_alloc could adopt pointers allocated without it
<Keybuk> jMCg: in fact, you hit the nail right on the head
<Keybuk> the reason that Upstart doesn't (right now) have "run as user" support is because I want to do something a little more different and clever using capabilities and cgroups
<Keybuk> the "run as user" feature will actually run things in a full PAM session for that user (as if they logged in and ran it)
<Keybuk> whereas the "non-root service" feature will be much more useful
<jMCg> Keybuk: that's very cool -- is there an ETA for that? Or anything I can help with (or code I can steal from you, to use for my long due port of mod_privileges to Linux)?
<Keybuk> jMCg: sometime in the next 18 months
<sadmac2> Keybuk: are you getting to reading the triggers thing I posted on upstart-devel?
<sadmac2> Keybuk: I'm sure you're still swamped :) its just taking a lot of code to implement, and I'd hate to do all of it just to have you slap it down :)
<sadmac2> With luck it will at least give us something to talk about in Portland
<Keybuk> sadmac2: I haven't read it yet
<Keybuk> I'll try and read through it later today :)
<sadmac2> cool :)
<pquerna> hi, i have a question about upstart... does anyone use it more like.. DJB's Daemontools for managing a small set of services? (not the whole os...)
<sadmac2> pquerna: upstart doesn't like not being pid 1 unless you compile it specially
<pquerna> yeah, I'm just looking for something somewhat more.. modern to replace daemontools. upstart seems like the coolest kid on the block though.
<pquerna> $new_job uses a series of shell scripts spawning things into screen instances.... not exactly what i'd like to use forever :)
#upstart 2009-09-02
<keesj> Is there a way to listen to upstart events?
<keesj> like the initctl events
<sadmac2> keesj: not anymore
<keesj> bugger 
<keesj> I guess the "new" way of doing this would be to use dbus right?
<sadmac2> keesj: doing what exactly?
<keesj> I would like to supervise the events happening in upstart
<keesj> mainly services stopping / crashing and such
<sadmac2> yes. dbus should get you that.
<keesj> with or without upstart hacking?
<sadmac2> without
<keesj> lets kick dbus-monitor then :P thanks
<Keybuk> dbus won't get you that
<sadmac2> Keybuk: we have signals for "service up" and "service down" don't we?
<sadmac2> or at least you can watch for new/vanishing objects
<Keybuk> right
<Keybuk> there are signals for that kind of thing
<Keybuk> just not generic events
<sadmac2> Keybuk: yeah. so dbus gets him what he was fundimentally interested in seeing.
<Keybuk> right
<ion> keybuk: If you have a bit of free time, would you mind satisfying my curiosity by explaining how youâve figured Upstart 0.6 would handle the fsck+mount thing? :-)
<ion> s/explaining/describing/
<Keybuk> oh, that's easy
<Keybuk> you have a udev rule that parses fstab, and fills in the details
<Keybuk> then you have an upstart job that matches those details
<Keybuk> which calls mount
<Keybuk> and then parses fstab again, and emits a can-mount event for anything underneath it
<Keybuk> start on (block-device-added
<Keybuk>   and can-mount $DEVNAME
<Keybuk> exec mount $DEVNAME
<Keybuk> post-stop exec what-can-we-mount $DEVNAME
<Keybuk> etc.
<ion> How will you handle blocking fsck instances that work on the same physical device?
<Keybuk> you can do that with simple locking
<ion> I have the prototype sh code that does some /sys traversing to get from /dev/some-lvm-device to some-md-device to [sda/sda1, sdb/sdb1] to [sda, sdb] somewhere. I could finish it; it could be used to get the list of names for the locks.
<ion> flock(1) from util-linux could be useful here. It would need to be moved from /usr/bin to /bin, though.
<Keybuk> the problem with the pure-upstart case though is how inefficient it is
<Keybuk> you have to keep on re-parsing fstab
<ion> Are you going to implement that for karmic nevertheless?
<Keybuk> no
<Keybuk> for karmic, I'm going with the "program that calls fsck, mount and swapon in the right order" approach
<ion> Ok
<wasabi> upstart have a 'user' option yet? 
<sadmac2> wasabi: no.
<wasabi> There a dh_* to install job files?
<sadmac2> wasabi: I don't think I know what that is. Is it debian-related?
<wasabi> Yeah
<ion> 2008-10-15 17:46:28 < Keybuk> suihkulokki: I do not think dh_ anything is a good idea
<ion> 2008-10-15 17:46:42 < Keybuk> what's wrong with just shipping the file as a conffile?
<wasabi> Nothing. That's what I'm doing.
<wasabi> Just wondering. I like dh_ stuff.
#upstart 2009-09-03
<wasabi_> So why doesn't upstart have a 'user' stanza?
<wasabi_> I can imagine it being hard for pid 1 to do namemapping, yeah.
<sadmac2> wasabi_: nobody's gotten around to implementing one
<sadmac2> wasabi_: su does the trick
<wasabi_> Ahh.
<wasabi_> Hmm. Does su end up execing, or does it fork first?
<wasabi_> Want to make sure upstart's TERM still goes to the right place.
<sadmac2> su should just exec
<jMCg> wasabi_: you need a TERM? More importantly: upstart has a TERM!?
<wasabi_> stop sends TERM, n o?
<wasabi_> sigterm.
<jMCg> Ah. I thought you meant the environment variable.
<wasabi_> Oh.
<wasabi_> Using 'su' sure creates a lot of unnecessary processes, though.
<jMCg> wasabi_: whatabout sudo -u $user ?
<sadmac2> wasabi_: huh?
<sadmac2> wasabi_: su shouldn't create any additional processes methinks
<jMCg> Maybe your various wrappers do.
<wasabi_> 'su' keeps running, and it creates a shell to run the specified command in.
<wasabi_> Since the -c option is a shell script.
<sadmac2> wasabi_: check the manpage. there should be a way to make that not happen
<wasabi_> Doesn't seem to.
<sadmac2> either way it shouldn't "create" a shell. It should exec() a shell
<jMCg> "-c will cause the next argument to be treated as a command by most command interpreters. The command will be executed by the shell specified in /etc/passwd for the target user."
<wasabi_> Well, it's not. Clearly.
<wasabi_> and yeah, stopping it sends sigterm to the wrong place.
<wasabi_> Heh.
<sadmac2> fun
<jMCg> Now, one could try to specify -s /binhrmpfzd... bleh. exec is a shell-builtin....
<wasabi_> Yeah. No way to pass an arg list though
<wasabi_> Oh I see
<jMCg> Anyways, I'm pretty much very sure (because I myself abuse it) that sudo does not start a funky shell.
<jMCg> jmcg@metis ~ % ps -cafe|grep -i [s]udo
<jMCg> 1 jmcg@metis ~ %         
<jMCg> As opposed to (and I'm only giving a grep -c here): jmcg@metis ~ % ps -cafe| grep -c [h]ttpd
<jMCg> 91
<jMCg> And script starts this with sudo, but there's no trace of.. 
<jMCg> http://dpaste.com/89133/ nope.. no trace of shell or su or sudo or anthing.
<wasabi_> Can't get sudo to run from upstart though. Grrr.
<wasabi_> Ahh. I see
<wasabi_> -c on sudo does not support args.
<wasabi_> it tries to exec the string, and finds no command.
<wasabi_> Argh. And I can't use -g in sudo. Says the root user isn't allowed to do it.
<wasabi_> And I'm not going to monkey with perms.
<Keybuk> exec su -c "exec command" user
<Keybuk> ;)
<wasabi_> su stays around.
<Keybuk> yes
<Keybuk> but the process group is the same
<wasabi_> Oh
<Keybuk> so init sends SIGTERM to both su and its child process
<wasabi_> From what I can tell the child does get it.
<wasabi_> Begins a shutdown process (which can take awhile)
<wasabi_> ANd then init reports it exists with 255.
<wasabi_> exits
<wasabi_> And the child keeps shutting down.
<wasabi_> So su is disappearing.
<Keybuk> oh, right
<Keybuk> yeah that can happen
<wasabi_> Uh huh.
<Keybuk> it's not ideal
<wasabi_> Sure isn't.
<wasabi_> I think a 'user' stanza added to upstart would make me happy.
<Keybuk> it wouldn't make me happy
<wasabi_> Name lookup?
<Keybuk> no, it's wrong
<wasabi_> Oh. Why?
<Keybuk> give me 30s and I'll describe how I see it working ;)
<Keybuk> just need to finish a function
<wasabi_> okay
<Keybuk> right
<Keybuk> so "run as user" means lots of different things
<Keybuk> for example, a user's cron job
<Keybuk> that doesn't just run setuid the user
<Keybuk> but it runs *as* the user
<Keybuk> it's setuid, initgroups() is used *and* PAM is invoked to set up a full user session
<Keybuk> and Upstart needs to support user owned jobs that behave in this fashion
<Keybuk> *separate* to that is the notion of dropping privileges
<Keybuk> dropping privileges may include calling setuid()
<Keybuk> but that's a numpty's function
<Keybuk> what you really want to specify is the real *and* effective uids of the job
<Keybuk> and any capabilities to retain
<wasabi_> Hmm
<wasabi_> I see.
<Keybuk> for example, you should be able to say that named runs with real and effective "bind" but retains CAP_NET_BIND_SERVICE
<wasabi_> So it's obviously more complicated than just user.
<Keybuk> yes
<Keybuk> and then there's the permission side of ti
<Keybuk> as "scott", I should be able to send init commands to start and stop my jobs
<Keybuk> or start and stop jobs that I am permitted to start and stop, which runs as my user
<wasabi_> Yeah.
<Keybuk> and that then brings the problem of security on a job
<Keybuk> and interestingly, means that the "user" of a job need not be specified in the config
<Keybuk> (or "any user" for example)
<ion> keybuk: Did whatshisnick talk to you about Linux capabilities? In Solaris SMF, he said, you can declare a job to run as an unprivileged user but with the rights to open port <1024 for instance. Linux has equivalent capabilities functionality, Upstart would just need to implement support for that along with the rest of the run-as-user functionality.
<ion> /usr/include/linux/capability.h
<ion> Better: capabilities(7)
<ion> user www-data
<ion> capabilities net-bind-service
<ion> exec /usr/bin/apache2 --foo
<Keybuk> right
<Keybuk> that's exactly what I was waffling about above
<Keybuk> though I wouldn't use "user" there
<Keybuk> it's more "real uid www-data" ;)
<ion> Hah, now that i actually look at the discussion, i realize i was just repeating what was already said. Iâve been watching a movie and missed the discussion; just noticed something about the âuserâ of a job and mentioned what jmcg talked about recently.
<sadmac2> Keybuk: so what does the UI for that look like?
<sadmac2> Keybuk: To play devils advocate, a "user" stanza would do something that most end users would understand. There's a very simple expectation for the behavior of that.
<Keybuk> that's the bit I don't know
<Keybuk> right
<Keybuk> and I want the simple expectation to always fail
<Keybuk> which is why I want to avoid a "user" stanza
<sadmac2> Keybuk: we should probably discuss the "and" operator while I'm thinking of it. You want to keep it around and non-deprecated last I brought it up?
<Keybuk> for while, yes
<sadmac2> Keybuk: ah. That's very different :)
<sadmac2> Keybuk: and for events is wrong, wrong and terribly wrong. For states it makes perfect sense.
<Keybuk> right
<Keybuk> while something and something or someting
<Keybuk> on foo
<Keybuk> on bar
<Keybuk> on baz
<Keybuk> hourly
<Keybuk> at the hour of scampering
<Keybuk> 40 minutes after tea
<Keybuk> etc.
<Keybuk> all of the "event" bits are OR
<Keybuk> if you want AND
<Keybuk> from event until SOME OTHER EVENT and while something
<Keybuk> on foo
<sadmac2> Keybuk: 0.6 compatibility means we have to keep AND around, which hurts since ripping it out deletes about 1/4 of upstart's code :)
<Keybuk> yeah
<sadmac2> its kinda-sorta less painful with triggers.
<Keybuk> but then you guys never went with 0.6 anyway, did you? :p
<sadmac2> we didn't... so there is that...
<Keybuk> which means you have nice crasher bugs
<Keybuk> but hey ;)
<sadmac2> you picked a bad time in our release cycle for 0.6 :(
<Keybuk> you picked a bad time in your release cycle to ship a version of init with known serious bugs ;)
<sadmac2> also our system is kind of dependent on state transfer working (even the broken version we got)
<ion> All the major Linux distributions should live together for a while, so their periods would get synchronized.
<sadmac2> ion: well, we certainly have enough douches to clean the mess up.
<ion> *zing*
<sadmac2> Keybuk: there's bugs and then there's bug reports. The loudest userbase in linux is staying quiet on upstart. Life is good.
<Keybuk> loudest userbase? :)
<sadmac2> Keybuk: curmudgeons love fedora
<Keybuk> yes, but there's so few of them ;)
<sadmac2> I wish
<sadmac2> Keybuk: you aren't perchance going to JLS?
<sadmac2> http://gcc.gnu.org/wiki/Var_Tracking_Assignments
<jMCg> wuhwvmpfzd.. for a second there, I read "JCL" ...
#upstart 2009-09-05
<PuffTheMagic> any devs around?
<PuffTheMagic> im having some issues building upstart
<PuffTheMagic> cross compiling it actually
<PuffTheMagic> nih-dbus-tool is build with the wrong compiler
<PuffTheMagic> if is needed durring the build
<PuffTheMagic> it needs to be built with the host compiler
<PuffTheMagic> and then if it is needed after building it needs to be built again with the cross compiler
<sadmac> PuffTheMagic: yep.
<sadmac> PuffTheMagic: there was a thread on devel-list about this
<sadmac> PuffTheMagic: not sure if a fix was ever determined
<PuffTheMagic> is there a patch on that thread to fix it?
<PuffTheMagic> or just talk
<sadmac> just talk
<PuffTheMagic> :/
<PuffTheMagic> im not really a autotools expert
<PuffTheMagic> i was hoping i wouldnt have to resort to qemu to build this
<mbiebl> PuffTheMagic: which distro and which arch do you want to compile it for?
<PuffTheMagic> i am trying to replace the upstart on the Palm Pre so that i can have dbus support
<PuffTheMagic> so target armv7
<PuffTheMagic> but im doing the cross compiling on gentoo
<mbiebl> for debian there are ready-to-run qemu images for different archs.
<PuffTheMagic> hmm i will check them out
<mbiebl> which I had used in the past to examine build failures on certain archs
<mbiebl> maybe that helps: http://people.debian.org/~aurel32/qemu/
<PuffTheMagic> i have a chroot
<PuffTheMagic> with a gentoo arm image
<PuffTheMagic> so i just need the kernel
<PuffTheMagic> and im all set
<PuffTheMagic> i just didnt want to do it this way thats all
#upstart 2009-09-06
<ion> http://clang.llvm.org/diagnostics.html
<sadmac> ion: yeah. fedora-devel got an email about that. "Please start using this immediately" it said
<ion> :-P
<sadmac> Keybuk: don't suppose you're around?
 * sadmac is having dbus permission problems
#upstart 2010-09-06
<JanC> if it would be standardized it wouldn't be that bad  âº
<mshadle> ion: wrong, the /etc/init/* files are replaced/kept up to date by package management, whereas your personal overrides are in /etc/default/$foo
#upstart 2010-09-07
<jabba> hello
<jabba> how do i tell an upstart script how to shutdown a process?
<ion> Use pre-stop exec/script
#upstart 2010-09-08
<crazy2be> Is there some way that i can get upstart to run a task with a certain username/userid? Or is there another tool that is better suited to that task?
<crazy2be> My server is written in golang, and i want to sandbox it somewhat in case there are vulnerabilities in my code (or the runtime!)
<ashb> crazy2be: sudo/su
<ashb> exec sudo -u me bash -c "command goes here" has always been how i've done it
<crazy2be> what happens when you run those as root? Never done that... I'll give it a try
<crazy2be> btw, thanks for this great utility!
<crazy2be> ubuntu is working great for my server
<crazy2be> even if it's the desktop edition :P server edition wouldn't work with my hardware
<ashb> hmmmm should upstart not have a dep on dbus?
<ashb> status: Unable to connect to system bus: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory
<ion> Run the command as root
<ion> The daemon is optional. Itâs only needed for non-root access.
<ashb> ah
<ashb> ah yes.
<ashb> what should I do if i want to send a USR2 signal to a job
<ashb> use a clasic init script that wraps initctl to do everything else?
<ion> Something like killed=false; eval "$(LC_ALL=C initctl status tty6 | sed -nre 's/.* process ([0-9]+).*/kill -USR2 \1; killed=true/p')"
<ashb> where? (is there a better place than an init.d script?
<ion> Whatâs the USR2 for? If reloading config or something like that, alas, currently the signal for reload is not configurable.
<ashb> kinda yeah - its to make the unicorn (ruby webserver) spawn a new master and kill the old one seamlessly
<ion> I take it Unicorn canât be configured to do that on SIGHUP?
<ashb> sighup would work if i didn't want seamless
<ashb> that makes it kill all its children then start again, but doesn't workj when you load app before forking the workers
<ion> And thatâs not configurable?
<ashb> nope
<ion> There might be no pretty solution until the signal sent by reload becomes configurable.
<ashb> k
#upstart 2010-09-09
<malomalo> I have the following upstart script: https://gist.github.com/50753d00b69feacc1908. I was wondering if I do a restart does upstart remember the password and port to start the server with?
#upstart 2010-09-11
<necrodearia> I do not understand sysvinit/upstart so well.  Is https://help.ubuntu.com/community/UbuntuBootupHowto written for sysvinit or is it something compatible with upstart also?  How can I write an init script for a particular application so that it is compatible with upstart?
<ashb> necrodearia: typical init scripts and upstart scripts are incompattible
<ashb> but you can write an upstart job then sylmink in /lib/init/upstart-job to get the classing init script cmd line
#upstart 2010-09-12
<corecode> hey
<corecode> so, how do i add upstart jobs manually?
<corecode> tells me: start: Unknown job: foo
<corecode> is there more than just adding /etc/init/foo.conf?
<ion> Youâll probably find a parse error for foo.conf from syslog.
<corecode> ah, it was hidden in daemon.log
<corecode> not a particularly helpful error message
<corecode> thanks
<johnf> is it possible to get upstart to run the same script and keep it runninf 10 times? ie I have 10 workers listening on a queue and I want them always running
<ion> foo.conf: âinstance $IDâ, start foo ID=3. Unfortunately, a single job canât currently autostart multiple instances based on a single event. You can work around that by creating another job, e.g. foo-starter.conf: âstart on filesystemâ, âstop on runlevel [06]â, âpre-start scriptâ, â  for n in 0 1 2 3â, â    start foo ID="$n"â, â  doneâ, âend scriptâ, âpost-stop scriptâ, â  for n in 0 1 2 3â, â    stop foo ID="$n"â, â  ...
<ion> ... doneâ, âend scriptâ.
<johnf> thanks!
<ion> Probably better do âstop foo ID="$n" || :â in the post-stop script.
#upstart 2011-09-05
<__TJ__> does upstart facilitate in some kind of statics ?  if we have upstart automatically respawn applications when any has crashed, we would like to know how many times this has happened..... 
<jhunt_> __TJ__: no, no statistics at present. The 3 main options you have currently: (1) run upstart with log-priority of "debug" and grep the system log for restart messages, (2) log your own statistics by having a script section write a log each time the application starts, or (3) create a new job which looks for the main job starting and writes some statistics.
<jhunt_> I'll add details on this to the Upstart Cookbook...
<__TJ__> jhunt_: thanks.... was just now thinking about some script or binary that will be ran by the upstart script itself by the pre-start section....
<__TJ__> the only thing needed then will be the pre-start command being run also when respawn is done
<__TJ__> but i assume thats the case
<__TJ__> jhunt: using the pre start for the statistics is also a good approach ?
<codebeaker> is there any recommended way to show upstart statuses inside of a web app? I'd like to offer my users the ability to emit signals and see what's running according to the initctl daemon
<jhunt_> sounds potentially dangerous to me, but if you really want to do this, but d-bus gives you a consistent api. Examples using dbus-send: http://upstart.ubuntu.com/cookbook/#controlling-upstart-using-d-bus
<codebeaker> thanks jhunt_ I think it's a bad idea too :) but I've been tasked with weighing it up, and seeing it it's at least viable
<codebeaker> thanks jhunt_ - that looks good - upstart docs are getting better all the time
<jhunt_> codebeaker: np.
#upstart 2011-09-07
<gilbertl> hi
<gilbertl> what is the opposite of set -e ?
<gilbertl> upstart seems to be skipping some commands and I want to make sure that is the case
<gilbertl> (that the skipping is caused by previous errors)
<ryoohki> what is the proper way to stop processes starting on boot?  "chkconfig service off"  that kind of thing
<jhunt> ryoohki: http://upstart.ubuntu.com/cookbook/#disabling-a-job-from-automatically-starting
<ryoohki> manual
<ryoohki> jhunt: thanks!
<ryoohki> jhunt: will there be a command like "initctrl service manual" which would create a /etc/init/service.override file with a manual stanza?
<jhunt> ryoohki: yes, we are working on a new initctl command that will allow jobs to be disabled.
<briandquinn> hi all, is there a way to allow a standard user control upstart jobs without sudo?
#upstart 2011-09-08
<iverson0881> hi, wanted to know if anyone is willing to help me understand why something is happening with launching an instance upstart job
<iverson0881> basically i'm using sudo -u someuser and some jobs start with that user and some do not
<iverson0881> I'm launching about 48 instances and it's really odd that some are starting with the proper user and some are starting as root
<iverson0881> thank you in advance, this is happening on Ubuntu 11.04
<iverson0881> I seem to be able to start all my processes as the correct user if I use su -c command user
<iverson0881> but I cannot stop them now
<iverson0881> using sudo -u user seems to work for both starting and stopping but it doesn't seem to guarantee that the user will be the user i want it to be 
<ambro718> Hi. How do I get an upstart embedded script to be executed by bash not dash?
<ion> Why?
<ion> exec /path/to/your/script
<ambro718> right.. I wonder why there is a "script" feature if it's essentially useless
<ambro718> like using a shell which doesn't have arrays
#upstart 2011-09-09
<iverson0881> Hi, i was wondering why some jobs that I start with sudo -u $user don't necessarily start with $user, they sometimes can start with root, 
<iverson0881> I'm using the instance feature of upstart and and experiencing this
<BLZbubba> is there an option to use "console file /tmp/upstart.log" or something like that instead of "console output"
<BLZbubba> my system doesn't have a console so it's impossible to debug boot problems currently
<frewsxcv> so if i run my conf script manually, it runs my service fine, but upstart, it doesn't
<frewsxcv> what can i do to debug this
<cyberlogi> Hi all. I'm trying to execute scripts using upstart as a different user. For example:    exec su -s /bin/bash -c 'exec "$0" "$@"' ubuntu -- whoami >> /home/ubuntu/test.log     works fine, but I can't figure out how to get it to login as the user and load the .bashrc options
<cyberlogi> exit
<PuffTheMagic> is there anyway to run upstart as non pid=1
<PuffTheMagic> im trying to debug something without a console
<PuffTheMagic> and i cant do that if upstart has to be init=1
<PuffTheMagic> pid=1
#upstart 2012-09-03
<hypermux> hi. how can i get upstart to see my conf file? i created /etc/init/myserver.conf
<hypermux> but when i initctl list | grep myserver
<hypermux> i dont see it
<ion> Look at the error message in syslog.
<pixie79> hi all, my devs want to use perlbrew for running perl daemons out of  - which need to run under the user nobody who has no shell. perlbrew uses a bashrc style file to setup its environment - is there a way to source the environment but not give the user a shell and still run under perlbrew whilst the process has been launched by nobody?
<SpamapS> pixie79: yes
<SpamapS> pixie79: you can setup the environment before you switch users very easily
<pixie79> ok that would be good, and keep the running user as a non login user for security?
<SpamapS> pixie79: is there any reason you can't put the environment variables in the upstart job as env statements?
<pixie79> SpamapS: that is what i said but they seemed to think they would not be populated down to forked scripts which the dameon starts
<SpamapS> of course it will
<SpamapS> unless those daemons explicitly set an environment different than their own
<pixie79> thanks - i will take it back to them
<pixie79> does this make sense'   start on started tty /dev/tty '
<pixie79> or /dev/tty1 even
<pixie79> i seem to be in a mix where we have things on initctl but being started by init.d
<SpamapS> hm
<SpamapS> pixie79: why are you starting after tty?
<SpamapS> pixie79: 99.9% of things should be 'start on runlevel [2345]'
<pixie79> yep i realised that after - although some things seem to start sometimes and not others
<SpamapS> pixie79: if there are errors in any of the tracked processes, you'll see that in /var/log/syslog
<pixie79> SpamapS: what is the best way to tell init to wait for a user to exist before starting a process - i am thinking zabbix here - the user exists in ldap via sssd which seems to sometimes start later and then takes a few seconds to cache
<SpamapS> wait for a user to exist?
<SpamapS> pixie79: sssd is local?
<pixie79> sssd is a local daemon that caches ldap
<pixie79> which is remote
<SpamapS> pixie79: sounds like the job should be retrying if it is meant to depend on a network service.
<pixie79> SpamapS: it is set to but seems to get stuck start/running - but is not running
<SpamapS> pixie79: another option is to have sssd emit an event when it is ready to serve requests (if it is already an upstart job, 'started sssd') and start on that... but IMO, that becomes complicated.
<pixie79> ok - i might add a pre to do a getent passwd zabbix| grep zabbix and match if that is true
<SpamapS> pixie79: best option might be to start sssd from a separate task that does 'start on starting rc-sysinit' .. that will make sure sssd is started before runlevel 2
<pixie79> ok
<SpamapS> pixie79: which it should be doing, because really if it provides user services, it should be started and operational before "multi user mode"
<SpamapS> pixie79: where is sssd coming from, btw? a package or somewhere else?
<pixie79> yep - no i think redhat have just added it to init.d
<pixie79> but it would seem init kicks in before or at the same time
<SpamapS> pixie79: what OS is this?
<pixie79> rhel 6.3 but under openvz
<SpamapS> pixie79: yeah, so I'm not sure if rhel6.3 has 'rc-sysinit'.. 
<pixie79> this seems to do the tick, after start on started sssd; in the zabbix script pre-start with if ! [ `/bin/sh -c '/bin/chmod 1777 /dev/shm'; sleep 10; getent passwd zabbix | cut -f 1 -d :` == "zabbix" ]; then echo "Zabbix User does not Exist yet" | logger -t ZABBIX -p daemon.info; stop; exit 0; fi
<jMCg> This is a horrible script ^
#upstart 2012-09-05
<rbasak> Hellok, I'm trying to debug a an upstart boot configuration issue (cloud-init-nonet). I'm supply --debug on the kernel commandline, and this works until syslog starts, at which point I no longer see upstart debugging on the console. But I'm trying to understand the timing of events between upstart and various other things outputting to console, so ordering is important for me, and just reading syslog is insufficient. How do I get upstart to not switch t
<rbasak> o syslog?
<rbasak> Or must I configure syslog to dump upstart syslog to console?
<SpamapS> rbasak: 
<SpamapS> rbasak: oops.. interesting is what I meant to type. ;)
<rbasak> SpamapS: I think reconfiguring rsyslog is the way forward, but I've failed at it so far
<rbasak> Unfortunately the documentation seems to assume that I want to learn everything about it before I can perform a simple task :-/
<SpamapS> rbasak: why exactly can't you just look at /var/log/syslog?
<rbasak> I can, but that doesn't give the ordering of events between what's in /var/log/syslog and what else printed to the console
<rbasak> Also, I'm interested in what happens before rsyslog was running, which _was_ printed to the console
<rbasak> Right now, I'm getting half the logs I want to /dev/console, but suddenly they stop and the upstart-specific stuff suddenly gets redirected to /var/log/syslog
<rbasak> (this is a system to which I have a serial console connected to conserver and thus both live view and logging to a file)
<rbasak> And it's a boot issue, so this makes most sense for me
<SpamapS> rbasak: well it will mess a bit w/ the ordering, but you could just 'echo manual | sudo tee -a /etc/init/rsyslog.override'
<SpamapS> rbasak: which will make rsyslog not start
<rbasak> I can try that - I hope it won't cause the problem to change :-/
<SpamapS> it really shouldn't
<SpamapS> but it might speed up or slow down a race
<SpamapS> which would actually be great info
<SpamapS> since you'd find that there was a race :)
<rbasak> It's a race I'm trying to fix!
<rbasak> (at least I think it's a race)
<SpamapS> rbasak: what are the symptoms?
<rbasak> cloud-nonet hangs and times out on no network configured, so cloud-init never runs. And then the network gets configured.
<rbasak> I think something is fundamentally wrong with the cloud-init-nonet mechanism
<rbasak> (which is horrible enough as it is)
<rbasak> SpamapS: reproduced with rsyslog disabled, but I still don't see the upstart logs in console after some particular point :-/
<rbasak> And now /var/log/syslog doesn't exist
<SpamapS> rbasak: have you looked at dmesg ?
<rbasak> No. Looks like it's going into dmesg
<SpamapS> yeah, upstart logs to kmsg for all that early boot hotness :)
<rbasak> What is causing kmsg to stop logging to /dev/console halfway through the boot?
<SpamapS> no clue
<SpamapS> could be something that is 'console owner'
<pixie79> hi all - any ideas how i get the correct pid for a process that appears to fork 6 times when starting?
<SpamapS> pixie79: ugh. step 1: slap the author around a bit. ;)
<SpamapS> pixie79: no but seriously.. *why* does it fork 6 times?
<pixie79> SpamapS: who knows - but i have asked the developers that
<SpamapS> pixie79: perhaps those are 6 different pids that all do different things?
<SpamapS> pixie79: whats important is finding the single "control pid"
<SpamapS> pixie79: entirely possible that the first or second fork is the "right one"
<pixie79> SpamapS: nope, the first few disappear then we get left with two processes at the end
<pixie79> one of whoms ppid is '1'
<pixie79> any other ideas on how to follow the chain past two ?
<rbasak> Found it. /etc/sysctl.d/10-console-messages.conf turns off logging to console when upstart runs the procps task
<xaka> is there plan to add support for dependencies like "when i start A and it depends on B and B is not running - start B first and then start A"? in current version i can achieve that by using pre-start hook, but that is quite dirty solution and i'd like to see rule like "depends on A, B, ..."
<SpamapS> xaka: there is a long term desire to rewrite with knowledge of state, mentioned in this bug and others https://bugs.launchpad.net/upstart/+bug/447654
<SpamapS> xaka: you can, for now, do it with one line in the pre-start (on Ubuntu.. others don't have wait-for-state jobs)  start wait-for-state WAIT_FOR=A WAITER=me
<SpamapS> xaka: personally though, I believe that such situations should be avoidable and things should be started "when they can", not "only when they are needed"
<pixie79> SpamapS: well for information i got the following back from the programs devs. The first process forks then execs the process which needs to run, this process will then fork, and then fork once more into two processes leaving me with the two final processes one parent and one child
<SpamapS> pixie79: thats not really an answer to the question of "why are you doing it wrong" thats just "yes we are doing it wrong"
<pixie79> yep lol - but unfortunately they are mostly a windows house and getting any part of a linux support is hard 
<SpamapS> pixie79: ah, so they're just not willing/able to learn how to properly daemonize?
<pixie79> SpamapS: yep prity much
<SpamapS> pixie79: well it would probably easier if you just didn't daemonize then. :-/
<SpamapS> pixie79: if thats not a possibility, then hopefully it writes a pid file somewhere?
<pixie79> i dont think we get anywhere on not daemonizing - i will check on a pid file
<pixie79> i didnt know you had the option of checking for one?
<pixie79> SpamapS: nope no pid either - i can see the current init.d job run as follows
<pixie79> qdadmin start >> /tmp/output 2>&1 
<pixie79> if [ $? = 0 ]
<pixie79> then success
<SpamapS> pixie79: how does it stop the program?
<pixie79> SpamapS: the same, just swop the word start for stop
<SpamapS> pixie79: there is an option to use the pid file, but you lose the 'respawn' capability, and have to run some kind of poll loop to check if the service is up in the post-start
<SpamapS> pixie79: ok, so you can just make the upstart job have a pre-start which does 'exec qdadmin start' and a post-stop of 'exec qdadmin stop'
<SpamapS> pixie79: you won't get a pid to track, but you don't *really* need one.
<SpamapS> pixie79: http://paste.ubuntu.com/1187651/
<SpamapS> pixie79: for 11.10 and later you will get logs in /var/log/upstart/$nameofjob.log
<pixie79> SpamapS: ok - so then if it fails over it needs to be manually restarted and montored
<SpamapS> pixie79: if its important, it should be monitored anyway. respawn is just to handle the most simple cases of failure
<pixie79> yes - i do have zabbix doing monitoring as well - but it is nice to have things automatically restart as well - save a lot of out of hours issues
<SpamapS> pixie79: daemonizing properly (or running without daemonizing) would also probably save a lot of hours of issues. :)
<pixie79> true 
<pixie79> SpamapS: well that is interesting - it would appear that when you do: qdadmin start it outputs the pid to syslog
<JanC> pixie79: how does "qdadmin stop" determine what process to stop?
<pixie79> JanC: i have no idea
<pixie79> qdadmin is a binary
<JanC> I suppose the programme's devs know that; but maybe it already uses a PID file or something similar?
#upstart 2012-09-07
<djh> Hi. I have a process that gets started by a shell script, which I've been told to move to being controlled by upstart. This naturally runs into problems with the PID that upstart gets when running the script isn't the PID of the daemon that gets started. I tried using "expect daemon" but this lea to suffering from the bug reported at https://bugs.launchpad.net/upstart/+bug/406397 where the process became unkillable.
<djh> Is there a "good" way to have Upstart manage an application that needs to be started & stopped by a shell script?
<ion> How about making it not daemonize?
<ion> No need to use âexpectâ then.
<ion> If you prevent Upstart from tracking the process it wonât know if it crashes.
<djh> How do I stop it daemonizing?
<ion> Depends on what the script is and does.
<djh> the script basically does a bunch of environment setup & then calls the server application
<SpamapS> djh: many server applications will have an argument to run in the foreground
<SpamapS> djh: there's only a few reasons to move server apps into upstart jobs. Either you need to orchestrate it starting up based on hardware/other services.. or you desire basic respawning
 * SpamapS carpet bombs http://stackoverflow.com/questions/tagged/upstart with answers...
<xaka> ...one of the daemons forks 4 times... - *facepalm*
#upstart 2012-09-08
<yetti> hi, quick question: I'm looking at the cookbook and noticed the pid stanza is not there. Is it no longer needed when using expect or what happened to it?
#upstart 2013-09-03
<uhpnou> hello on ubuntu 13.04 I am unable to reboot and shutdown from lightdm -> the problem is related to this upstart job http://pastebin.com/VchNK106 -> anyone can help?
#upstart 2013-09-04
<quickdry21> Hi, I've got Ubuntu 12.04.1 running on an EC2 instance (upstart 1.5-0ubuntu7). The init process explodes occasionally - ~1/week, consuming 100% CPU, is unresponsive and the system needs a reboot to regain control.
#upstart 2013-09-05
<tjaalton> when initctl list foo shows "foo stop/killed, process 12345" starting the daemon again just hangs
<tjaalton> any idea to fix that?
<tjaalton> without a reboot
<tjaalton> stop just says it's stopped already
<tjaalton> using saucy btw
<tjaalton> i've had this happen a few times with sssd being the daemon, and when it happens shutdown hangs as well, need to force poweroff the machine
<tjaalton> so sounds like a bug in upstart
<tjaalton> anyone?
<stgraber> tjaalton: hi
<stgraber> tjaalton: so I'm assuming you're talking about sssd right? :)
<stgraber> tjaalton: it gets into that state if the daemon fails (crashes) before it's done forking
<stgraber> tjaalton: in such a case, upstart hasn't figure the final PID for the process and so is tracking the wrong PID
<tjaalton> stgraber: yep
<tjaalton> but it can't clean up it's state?
<stgraber> tjaalton: unfortunately in such case, only a reboot can fix upstart's state (unless xnox or jodh know of a way around)
<tjaalton> okay
<tjaalton> fairly easy to get in that state
<tjaalton> like if there's a valid config that won't load because some other bits are missing
<stgraber> tjaalton: it's probably best to run with -i then and drop the expect fork
<stgraber> that way upstart won't use ptrace, so it should be way more reliable and also slightly faster (saves an extra fork and saves the use of ptrace)
<tjaalton> stgraber: interesting, i'll give it a go
<tjaalton> stgraber: i didn't get it to work
#upstart 2013-09-06
<Hammerhead2011-S> Hi all,
<Hammerhead2011-S> was wondering if anyone could assist with this
<Hammerhead2011-S> I have a 12.04 install running Virtualbox with a windows VM and a Ubuntu install 12.04 as VM's
<Hammerhead2011-S> The windows machine runs fine.
<Hammerhead2011-S> the Ubuntu machine will not enter routes for the "up" interfaces into the kernels route table
<Hammerhead2011-S> I can, after fully booted, manually enter them
#upstart 2013-09-07
<smaudet> Hey just someone else's recommendation that I poke you guys with this bug...its not an issue with upstart itself so I don't know how meaningful this is. In any case, not trying to spam. https://bugs.launchpad.net/ubuntu/+source/rpcbind/+bug/1222274
<smaudet> Cheers!
#upstart 2014-09-02
<wmp> hello, how to change init file? I thinks upstart dont seen my changes
#upstart 2014-09-03
<ion> wmp: Any errors about the file in syslog?
<wmp> ion: no
<wmp> ion: i have networking problem, maybe could you help me?
<wmp> my server down and i dont know how to up this...
<ion> wmp: Feel free to describe the problem. I or someone else might be able to help.
<wmp> http://pastebin.com/TPeqPELc
<wmp> i want to run bridge on eth0
<wmp> with normal eth0 configuration all works good
<wmp> but with this bridge i cannot connect to server
<ion> How about if you remove auto eth0, iface eth0 inet manual?
<wmp> ion: nothing
<wmp> ion: this same...
<ion> Iâm afraid i donât see the problem then. Perhaps someone else has ideas.
<bradleymeck> is there a way to set the uid numerically it looks like setuid expects a name only
#upstart 2014-09-04
* jodh changed the topic of #upstart to: Upstart 1.13.2 | http://upstart.ubuntu.com/cookbook/ | Post to mailing list if no response here: http://bit.ly/ooeNVv
<kierank> Is it possible to make upstart rules apply to legacy init.d scripts
<kierank> (snmpd in my case)
<jodh> kierank: no - upstart just runs the sysv scripts "as-is"
#upstart 2015-08-31
<leandrosansilva> Hello to all. I am using ubuntu 12.04 and need to know when a given service started/finished. Something similar to "running Since:" of systemctl status
#upstart 2015-09-02
<cristian_c> hello
