#upstart 2006-09-25
<maro_> btw, they're discussing initscripts on fedora-devel
<maro_> https://www.redhat.com/archives/fedora-devel-list/2006-September/msg00654.html
<cortana> what does the U in uevent stand for?
<ajgenius> cortana: user space
<ajgenius> same as in udev
<cortana> ah, thanks
<_ion> http://tech.rufy.com/2006/08/mapreduce-for-ruby-ridiculously-easy.html
* ..[topic/#upstart:Keybuk] : Upstart 0.2.7 | http://upstart.ubuntu.com/ | http://upstart.ubuntu.com/doc/getting-started.html | https://wiki.ubuntu.com/UpstartDesignChanges | irc logs: http://people.ubuntu.com/~fabbione/irclogs | http://www.lugradio.org/episodes/61
#upstart 2006-09-26
<_ion> Any freenet 0.7 users?
<_ion> http://johan.kiviniemi.name/software/random-background/random-background
<Keybuk> hmm?
<_ion> Sorry, that was offtopic. :-)
<_ion> Just something i wrote just now.
<Artanicus> seems you realy like ruby.. (:
<Keybuk> I've yet to learn ruby
<Keybuk> on first glance, it seems a little Python like, but without the nice syntax
<_ion> keybuk: Some propaganda: http://johan.kiviniemi.name/stuff/python-ruby/ :-)
<Keybuk> To get away with less typing, many Python programmers resort to making variables
<Keybuk> (and methods) public even when there's no reason for them to be public.
<Keybuk> that's not true
<Keybuk> Python actively discourages private anything, with the "programmers are consenting adults" theory
<Keybuk> __ is just a name-mangler
<Keybuk> class Foo:def __*(foo)
<Keybuk> just makes the method called __Foo_foo
<Keybuk> so in your example, world.__World_double() is an entirely legal call to get at the "private" method
<Keybuk> in general, that seems to be just a comparison of syntax though
<Keybuk> what's different about the /language/
<Keybuk> ie. what can I do in Ruby that I cannot do in Python?
<LarstiQ> _ion: I'd also disagree with that section on private methods, it doesn't reflect python reality
<LarstiQ> _ion: on len(obj) vs obj.len(), not sure if that is the reason, but len() will try a couple of different approaches
* LarstiQ blinks
<Keybuk> len is a built-in function
<LarstiQ> _ion: also problems with "self", notation of instance variables and an example of a class
<Keybuk> it just calls obj.__len__()
<LarstiQ> Keybuk: afaik, it can handle __len__ not being there if it has __getitem__
<Keybuk> it's a shame they didn't just make it a default len() method, but then early Python wasn't as "everything is an object" as modern python
<LarstiQ> but yes, that might have something to do with it too
* LarstiQ agrees it is not consistent but doesn't care that much
<_ion> 0) "Python actively discourages private anything"  yes, therefore i like Ruby more. :-) If you like Python more, that's your right. 1) Everything you can do in Ruby, you can do in Python, C, Haskell, Java, Lisp, 68000 asm etc. They are just different. Well, Python doesn't support closures. That's actually a very big win in my opinion. Some people don't regard them as useful (often Python advocates, it seems), and that's their right.
<_ion> That page is just my personal opinion, and everyone has (and should have) one. :-)
<Keybuk> "closures" ?
<_ion> http://martinfowler.com/bliki/Closure.html
<LarstiQ> python does support closures afaik
* LarstiQ reads the link
<_ion> Creating and referencing functions inside a function does not equal a closure.
<_ion> http://mail.python.org/pipermail/python-list/2004-July/229478.html
<Keybuk> http://ivan.truemesh.com/archives/000392.html
<Keybuk> that page gives you the Python examples
<Keybuk> ok, so Ruby has first-class closures
<_ion> If you read that page, you'll notice all the examples are oneliners.
<Keybuk> what does Python have that Ruby doesn't?
<_ion> That is not very handy. Python has lambda, but it doesn't support multiline code.
<_ion> Well, currently Python is faster.
<LarstiQ> explicitly by choice.
<Keybuk> is everything in Ruby also an introspectable object?
<_ion> Ruby 2.0 will have a new, fast VM.
<LarstiQ> _ion: I'm fine with opinions, but your examples are not how one would write python code, so it's not a fair comparison.
<LarstiQ> Keybuk: yes, and you can change the builtin types
<_ion> Those are examples of how i would write python code. :-)
<Keybuk> so functions are objects, which you can add methods to, or replace?
<LarstiQ> _ion: right, you're more writing ruby in python then
<Keybuk> so to make some Ruby code up
<Keybuk> class Random
<Keybuk>   def initialize
<_ion> larstiq: No. I first learned Python, then found Ruby.
<Keybuk>     @foo = @bar
<Keybuk>   end
<Keybuk>   def bar
<Keybuk>     ...
<Keybuk>   end
<LarstiQ> _ion: so? It's not pythonic
<Keybuk> end
<Keybuk> Random.new.foo
<Keybuk> does that work?
* LarstiQ is too weak in ruby to say
<LarstiQ> Keybuk: one thing that python has is more libraries
<Keybuk> LarstiQ: meh, Python's standard libraries SUCK
<_ion> @bar (an instance variable) and Random#bar (a method) are different.
<_ion> class Random
<Keybuk> the most irregularly inconsistent mish-mash of crack on earth
<_ion>   attr_reader :bar
<_ion>   def initialize
<_ion>     @bar = 42
<_ion>   end
<_ion> end
<_ion> Random.new.bar returns 42
<LarstiQ> Keybuk: that may be, ruby has less available
<Keybuk> _ion: that's not what I mean
<Keybuk> could I go  #foo = #bar
<Keybuk> ie. create a new method foo that's a copy of the bar method?
<LarstiQ> ruby has a distinction beween instance and module attributes, (and private/public), which is something I don't like
<Keybuk> (and ruby doesn't appear to be able to spell "initialise" :p)
<_ion> class Random
<_ion>   def bar
<_ion>     42
<_ion>   end
<_ion> end
<_ion> Random.class_eval { alias :foo :bar }
<Keybuk> _ion: can I do Random.foo = Random.bar
<_ion> Random.new.foo  # 42
<Keybuk> right
<Keybuk> so it appears that a major feature Python has over Ruby is that everything, including methods, is an object
<Keybuk> and that everything is introspectable
<Keybuk> Ruby appears to lack that
<Keybuk> a method in Python is just an object of a particular type that implements a __call__ method that executes the attached Python bytecode, etc.
<Keybuk> oh, another way of doing closures in Python, apparently:
<Keybuk> def foo(self, a, b, c):
<Keybuk>   def closure():
<Keybuk>     return a
<Keybuk>   some_call(closure)
<LarstiQ> that would be _the_ way to do closures?
<LarstiQ> although 2.5 has partial()
<Keybuk> that has the same "is executed in the namespace of the calling function" requirements
<Keybuk> of course, the key point about any language is the applicability of that language for certain tasks
<Keybuk> if you're doing low-level systems programming, then you write it in C
<Keybuk> if you're doing any kind of text munging, you write it in Perl
<Keybuk> Python seems to be winning for rapid tool and application creation
<Keybuk> there's a battle between C# and Python for "best GUI development" language
<Keybuk> I've not yet seen anything that makes web apps easy
<Keybuk> Perl, PHP and Python all seem equally bad at it
<Keybuk> Ruby on Rails seems popular this week
<Keybuk> though I must admit, from looking at the code of Typo, I can't see why
<LarstiQ> heh, Typo is in ruby and Typo3 in php? Joy :)
<Seveas> Keybuk, ever looked at django for webapps?
<Amaranth> django is the shit
<Amaranth> and it's been around quite some time so it's not just a fad
<Seveas> (the django lead dev uses ubuntu ;))
#upstart 2006-09-27
<wasabi_> heh. I tried to give the lugradio thing a listen. wow.
<LarstiQ> wow?
<wasabi_> I just can't take it.
* LarstiQ has never listened, yet.
<wasabi_> It's in the topic.
<LarstiQ> I'll try this one then :)
#upstart 2006-09-28
!alindeman:*! Hi all!  Sorry for the turbulence, I prematurely restarted a server that I rebuilt to add capacity to it.  Everything should be returning to normal.  If you experience trouble, please contact an on-duty staffer ( /stats p )
#upstart 2006-09-29
<Admiral_Chicago> facinating conversation eh?
<Trevelyan`> well it seems that everyone else here is in a different timezone to me, and/or different working hours.
<Keybuk> oh?
<Keybuk> it's been quiet here for a few days
<Keybuk> ubuntu beta release all that
<Keybuk> which I mostly spent chicken-pecking in vmware while playing transport tycoon in another window <g>
<Trevelyan`> i only said that because my backlog has chat in it, but always during the night 7pm to 4am.
<Keybuk> heh
<Keybuk> which timezone are you in?
<Trevelyan`> UTC+1 but will be UTC+0 when we switch from DST =)
<Keybuk> same as me then, technically
<Keybuk> I'm just not very good at actually obeying my own timzone
<juergbi> hi Keybuk any comments to my mail "local job changes"?
<Keybuk> juergbi: none other than thanks for bring it up, and that it does need to be thought about ;)
<Keybuk> I honestly haven't thought about that too much yet
<juergbi> Keybuk: ok, i just hope that something like my proposal can be integrated before it's already too painful to make changes to the directory structure ;)
<Keybuk> I'm not sure about the two files method thoug
<Keybuk> it's easy to add stanzas, but not remove them
<Keybuk> if you didn't want the pre-start script, how would you "remove" that?
<juergbi> there could be an additional element / keyword to prefix a line with which will result in removing a previous definition
<juergbi> i.e. "no start script" or "remove start script"
<Keybuk> at that point, you may as well just edit the priginal file though, surely?
<Keybuk> and have an intelligent merge tool
<juergbi> for well setup packages disable/enable is probably the only thing that gets used often
<juergbi> so it could also be a simpler file where just overridden enable/disable status gets listed
<juergbi> i'd be perfectly fine with that but the proposed approach would be more flexible
<Keybuk> probably also changes to the set of events that can trigger the job
<juergbi> yes, that's right
<juergbi> something like "no start on ..." to disable some triggers doesn't seem to bad to me
<Keybuk> except that you're then putting quite complex config file merging code into the init daemon to cope with shit package managers
<juergbi> i don't know upstart's parsing code but i presume that it would be fairly easy to implement something like that
<Keybuk> not especially actually
<Keybuk> you'd have to parse them both at the same time, no?
<Keybuk> or have code to deal with a "no" stanza and potentially remove or reset it
<juergbi> one right after the other like it was concatenated together
<Keybuk> but that's actually complex
<juergbi> just like iterating over more lines
<Keybuk> "pid timeout 22"
<Keybuk> "no pid timeout"
<Keybuk> what's the pid timeout?
<juergbi> like it hasn't been specified
<juergbi> the later one wins
<juergbi> so the distro-supplied should be parsed first
<Keybuk> which means you need to duplicate the entire config file parsing code
<Keybuk> and have a "reset to default" option
<juergbi> you're right with being able to get the default, yes
<juergbi> but the parsing could definitively be shared, imo
<Keybuk> it can't, because the parsing has to be different
<Keybuk> pid timeout <int> != no pid timeout
<Keybuk> otherwise what does "no pid timeout 42" mean? :p
<juergbi> ;)
<juergbi> i'd just allow all the no-stanzas in the original config file, too. it doesn't make sense to use them there but it'd be logical and easier
<juergbi> as written before, just look at them like one large file
<Keybuk> yeah, but you'd still have to write the config parsing code for the no stanzas
<Keybuk> which is reasonably large
<juergbi> yes, sure
<Keybuk> and some of them are quite complicated
<Keybuk> for example
<Keybuk> "no start on job-started apache2"
<Keybuk> you have to iterate the list of known start events for an event that matches
<juergbi> or maybe just check for "no" at the beginning of the parsing and then set a flag
<Keybuk> and do you then require an exact, or just a partial, match?
<juergbi> that would have to be defined. exat should suffice in my opinion
<juergbi> it could also be done in something like a pre-processing stage, i.e. just ignore all lines that are followed by the same line with a "no" prefix
<juergbi> but that wouldn't suit well the script stanzas, i guess
<Keybuk> that'd mean you'd have to process the /etc one first to read the no lines, then the /lib one to get the defaults, then the /etc one to get the overrides
<juergbi> with pre-processing, yes, was probably a bad idea
<Keybuk> what's wrong with just the usual conffile stuff on upgrade?
<Keybuk> or ucf if you want three-way merging
<juergbi> it's jsut less error-prone with separate files than with standard three-way merging
<juergbi> things like white-space or comment changes at the wrong place shouldn't have influence on the final config file
<juergbi> less questions, easier for the admin
<Keybuk> three-way merging can be done intelligently
<Keybuk> ie. by parsing both files and analysing the difference, rather than using patch
<juergbi> you mean format-specific?
<Keybuk> yes
<juergbi> yes, sure, that would probably work very well
<juergbi> but that would require effort for every distro instead of just making upstart more flexible
<juergbi> or adding such a three-way merge tool to upstart itself, that would be possible, too
<juergbi> i'm assuming that such a tool would require more work than modifying upstart, though
<Keybuk> the main reason I don't like the /lib idea is actually that it hides the config files
<Keybuk> it means you go into /etc/event.d and find that it's empty
<Keybuk> so you then have to read the /lib version
<Keybuk> and then decide what changes you want to make, and only write those changes in a pseudo-diff format
<Keybuk> and then you actually have an interesting problem which is that upgrades can break you silently
<Keybuk> at least with a conffile prompt, you know it might break
<juergbi> the advantage is that if you look at your changes some time later you know exactly what you've changed
<Keybuk> the obvious example being "no start on job-started apachew"
<Keybuk> what if the upstream change that in the /lib one to "start on job-start apache2" instead
<Keybuk> suddenly your admin edit is ignored
<Keybuk> (silently)
<juergbi> yes, that's right, that would also be problematic for three-way merging, though
<Keybuk> at least having to do the merge means you're aware of the problem
<juergbi> the events are part of the system interface and should be treated with corresponding stability guarantees, though
<juergbi> you can break every scheme if you want to but some make it harder
<Keybuk> job-started and job-start are both vaild events
<Keybuk> issued at different times
<juergbi> ah, i thought it was a version number change or something like that of the apache start script
<Keybuk> the upstream may have just wanted to slightly change when their job was started
<juergbi> yes, that's right
<Keybuk> which would suddenly break the sysadmin's change to make it *not* start
<juergbi> yes, might be problematic
<Keybuk> it's a complicated issue :p
<juergbi> what'd you say to a separate enable/disable file, at least?
<juergbi> should be very easy and non-problematic
<Keybuk> part of the reason I haven't applied _ion's patch yet is that I'm tempted that jobs shouldn't be disabled in the job files, but separately
<juergbi> good to hear that :)
<Keybuk> also understanding what disabled means
<Keybuk> if a job is disabled, can it be started manually?
<juergbi> intuitively i'd assume it's just like it had no start-stanzas
<Keybuk> right, Johan's patch actually prevents manual starts as well
<Keybuk> which is functionally equivalent to just deleting the /etc/event.d file :)
<juergbi> right ;)
<juergbi> there could also be a tri-state like service management in windows
<juergbi> disabled-manual-auto
<Keybuk> *nods*
<juergbi> if a job is running and set to manual it should probably remain running and if the job is set to disabled it should be stopped, i guess
<juergbi> when i get some time, i might even write a patch for it but can't right now
<juergbi> syntax should be very simple, something like "job-name enabled|manual|disabled"?
<LeoO> hello I made the mistake to install upstart without upstart-compat-sysv and now I can't boot at all anymore
<LeoO> any solution ?
<thom> LeoO: init=/bin/sh at the end of your grub command line
<LeoO> the error I get is init: rc-default process (4028) terminated with status 127
<LeoO> okay I'll try this
<LeoO> init=/bin/sh at the end of the grub file didn't do the trick
<LeoO> I'm still stuck with upstart without upstart-compat-sysv and now way to boot (even in safe mode)
<cortana> is there a previous init=something parameter?
<cortana> perhaps the kernel only looks at the first one
<LeoO> it's giving me a "init: unable to exectute '//sbin/logd/' ...'
<cortana> e.g. kernel /boot/foobar root=/dev/hda1 ro init=/bin/bash
<LeoO> oksa
<LeoO> lets try that
<LeoO> ok now I can reach sh but apt-get will not work
<Keybuk> mount -o rw,remount /
<Keybuk> ?
<LeoO> ttried mount -F -o rw, remount/
<LeoO> sent me error messages but I didn't wrote them down
<LeoO> okay now I could get rid of upstart but apt-get is trying to connect to the internet to reinstal sysvinit and since the network is not up it is a problem
<Keybuk> configure the network by hand?
<LeoO> how do you do that
<Keybuk> modprobe, ifconfig, dhclient, etc.
<LeoO> that sound messy
<Keybuk> you're running Debian?
<Keybuk> or Ubuntu?
<LeoO> maybe it would be sipmler to just reinstall ubuntu
<LeoO> edgy ubuntu
<Keybuk> just run /etc/init.d/rcS
<Keybuk> if you're running edgy, how come you had to install upstart-compat-sysv ?  it's installed by default
<LeoO> no
<LeoO> let me explain
<LeoO> I had edgy
<LeoO> but sysvinti was installed
<LeoO> sysvinit
<LeoO> and no upstart at all
<Keybuk> an old edgy?
<LeoO> its was an update from dapper
<LeoO> it was dist-upgraded everyday
<LeoO> yet, there was no upstart
<LeoO> so I apt-get installed it
<Keybuk> you didn't have ubuntu-minimal installed then?
<Keybuk> it probably got uninstalled by your system trying to keep sysvinit
<LeoO> I don't know
<Keybuk> we had some problems with that
<LeoO> there was some heavy problems with apt-get these last days
<LeoO> so
<Keybuk> yeah, not surprising
<Keybuk> it is in development, after all
<Keybuk> edgy's not been too bad
<LeoO> apt-get install upstart removed sysvinti and didn't install upstart-compat-sysv
<Keybuk> there haven't been many days that have left you without a functioning system
<Keybuk> often you can have a week or two without even a working libc
<LeoO> yeah
<LeoO> that's true
<Keybuk> it would have told you that you really should install upstart-compat-sysv in the apt-get output
<LeoO> edgy is very stable for a rc
<LeoO> no it didn't
<LeoO> just didn't said a word about it
<LeoO> using synaptic
<Keybuk> oh, dunno about synaptic
<Keybuk> you said apt-get :)
<LeoO> yaeah I was wrong
<LeoO> this is a big issue that synaptic doesn't behaves the same way apt-get does
<LeoO> well
<Keybuk> Recommended packages:
<Keybuk>   upstart-compat-sysv upstart-logd system-services
<Keybuk> The following packages will be installed:
<Keybuk>   upstart
<Keybuk> etc.
<LeoO> now I gonna reboot to try to see if I can cure that
<leoO> thaks for the help guys Im now back on dapper
<TheBearded1_> Could somebody tell me how upstart compares to initng?
<_ion> initng is based on dependencies, upstart is based on events.
<_ion> Search for 'initng' at http://www.netsplit.com/blog/articles/2006/08/26/upstart-in-universe
#upstart 2006-09-30
<XVampireX> Dapper to Edgy: Do I get upstart during the upgrade or do I have to manually install it?
<jwebb> Md, Hi...can you help me with a problem?
#upstart 2006-10-01
<cfraz89> hi, i'm having a problem in edgy where fsck is hanging, making my computer unable to boot
<cfraz89> i think it has something to do with upstart
<cfraz89> does anyone know how to disable upstart in edgy?
<Md> you can't
<cfraz89> you can't?
<cfraz89> it isnt possible anymore to use sysvinit?
<Md> I don't think so
<cfraz89> ok, thanks
<matti_> hi
<matti_> I have some wierd problems with nfs volumes that I want to mount on boot, could that be upsstarts fault?
<wasabi> Depends what the problem is.
<wasabi> Without knowing that, you're just asking for a guess.
<matti_> well I had ubuntu dapper before and switched to edgy, does upstart treat remote and local filesystems different or isn't uipstart involved into this process
<matti_> , wasabi
<wasabi> upstart isn't involved.
<wasabi> It still just runs the rc scripts, in the same order.
<matti_> okay thanks
<wasabi> So, it's sorta involved. ;)
<johnnybuoy> how do I use the status, start ans stop commands?
<johnnybuoy> i do status powernowd, but itsays id doesn't know it..
<johnnybuoy> okok! topic, I'll check whatever is in there first..
<_ion> powernowd doesn't install an upstart job. It still installs an init.d script.
<_ion> That is the case with most packages currently.
#upstart 2007-09-25
<JohnFlux> Hey all
<JohnFlux> It would be nice if the upstart library was installed with upstart on distros
<JohnFlux> so that people can use the upstart program
<JohnFlux> i mean use the upstart library from their programs
<JohnFlux_> Hey all
<JohnFlux_> anyone around?
#upstart 2007-09-26
<Tomasu> What would cause upstart and all related apps (init, initctl, shutdown) to all get connection refused errors when run? I can't shut the box/ve down properly..
<soren> Racoons.
<Tomasu> While I liked that show as a kid, I doubt it has much to do with my problem ;)
<soren> Show?
<Tomasu> cartoon I used to watch http://en.wikipedia.org/wiki/The_Raccoons
<Jc2k> wow.
<soren> Tomasu: I see. I was just talking about the animals. :)
<Tomasu> they are animals...
<Tomasu> :P
<soren> Tomasu: No, they're cartoon characters modeled after racoons. :)
<Tomasu> animated animals :P
<soren> thom: :P
<soren> Tomasu: :P
<soren> thom: never mind :)
#upstart 2007-09-28
<TomasuAway> I was wondering if anyone knows why init, shutdown and initctl complain about a refused connection and exit?
<TomasuAway> its an ubuntu gutsy tribe, with upstart..
#upstart 2008-09-22
<dayanandasaraswa> Hello friends,
<dayanandasaraswa> I am new to upstart..Actually I want to do one thing.. I want to print the message Hello World on the ubuntu start up screen..I mean the screen where the ubuntu logo is displayed and all the init scripts are executed. I want to print the message hello world there..How do i go abbout doing it
<dayanandasaraswa> Actuually I saw that fsck while checking my filesystem during start up is able to output at the start up sccreen, So there must be a way for me too to print in that screen..
<dayanandasaraswa> Can you tell me how....
<dayanandasaraswa> Any body there..
<ion_> Wow, almost fifteen minutes of patience.
#upstart 2008-09-23
<sadmac2> Keybuk: how was the flight back?
<Keybuk> hellish
<Keybuk> I can never sleep on planes
<sadmac2> unfortunate
<sadmac2> Keybuk: I've been pondering the idea of transitions in the state machine
<sadmac2> basically, right now if we have state A set, and we say when A on q B, we get state A and B true
<sadmac2> this is good, we want this
<sadmac2> but we might also want this:
<sadmac2> on q transition A to B
<sadmac2> so when q happens, A becomes false, and B becomes true
<Keybuk> it depends whether you reuse your A object for "A and C"
<Keybuk> otherwise it's just two different ways to look at the same effect?
<sadmac2> you'd want to reuse
<sadmac2> that'd be expected behavior for the user
<Keybuk> so
<Keybuk> when A on q B
<Keybuk> when A on r C
<Keybuk> ?
<Keybuk> I don't think you can express that if A transitions to B on q
<Keybuk> since you lost your A tracking for C
<sadmac2> yes, its not appropriate there
<Keybuk> so which you pick depends on the implementation I think
<sadmac2> some cases you want one behavior, some the other
<sadmac2> we can support both
<sadmac2> with different keywords
<sadmac2> when A on q B means if you have A and q happens you keep A and get B
<sadmac2> when A on q goto B means if you have A and q happens you lose A and get B
<Keybuk> would you want the latter behaviour if you have the former?
<sadmac2> runlevels
<Keybuk> sometimes it helps to have a use case for a feature before you worry about it
<sadmac2> think runlevels
<Keybuk> runlevels right now are just different values of A
<sadmac2> but we can view them as independent states
<Keybuk> we can, indeed
<Keybuk> here's an interesting thought
<Keybuk> if A is "runlevel 2"
<Keybuk> and B is "runlevel 3"
<Keybuk> if you transition from 2 to 3, you may not kill all the processes started by 2
<Keybuk> so would those still hold a reference on 2?
<sadmac2> right
<Keybuk> if A transitioned to B, would those suddenly have null references or reference a different state to what started them?
<sadmac2> hmm
<Keybuk> and if A just went away from the list of active states, and B got added, would that be bad?
<sadmac2> the processes in runlevels right now are outside of our management
<sadmac2> could we fix that? maybe.
<Keybuk> sure
<sadmac2> and can we fix it while the people using them remain oblivious to them?
<Keybuk> we could
<Keybuk> we may only fix it if they have LSB headers
<sadmac2> the thing we're missing is the references go the other way
<sadmac2> the services don't depend on the runlevel
<sadmac2> the runlevel depends on the services
<sadmac2> bringing up a runlevel brings up all the services.
<sadmac2> bringing up all the services doesn't necessarily change the runlevel (in fact the people wanting sysv compat would freak if that happened)
<Keybuk> it'd be interesting if it did :p
<sadmac2> interesting
<sadmac2> and I think we can do it
<Keybuk>   lamp = (apache, mysql) + auto
<Keybuk> start lamp
<Keybuk> will start apache and mysql
<sadmac2> but its not right for runlevels
<Keybuk> but
<Keybuk> start apache
<Keybuk> start mysql
<Keybuk> will also inherently say lamp is running
<Keybuk> why not? :P
<Keybuk> take the Fedora model
<Keybuk> if I boot into runlevel 3
<Keybuk> and I start X
<Keybuk> shouldn't it now say I'm in runlevel 5? :p
<Keybuk> because I am
<sadmac2> not according to sysv
<sadmac2> this is a compat mode. we can't do as much cool stuff here
<Keybuk> show me the line that says that cannot be true :p
<sadmac2> if it ain't broke, it ain't fixed
<sadmac2> I'll show you the mailing list that says it cannot be true :D
<Keybuk> sure
<Keybuk> url to the thread?
 * sadmac2 goes digging archives
<sadmac2> not a specific example, but:
<sadmac2> > Are you seriously suggesting that less than 50% of Fedora systems have
<sadmac2> > yum installed?
<sadmac2> yes; at least on my machines there is yum only on the host while
<sadmac2> guestsystems don't need it. Ratio of physical hosts to virtual
<sadmac2> ^^guy purporting not to have python on 3/4 of his fedora boxes
<sadmac2> point being: the people who care most about sysv compat are batshit insane
<Keybuk> http://cvs.fedoraproject.org/viewvc/rpms/upstart/devel/upstart-telinit-u.patch?revision=1.1&view=markup
<Keybuk> sorry to change the subject
<Keybuk> but about the patch
<sadmac2> yeah
<sadmac2> we'll need a new one won't we?
<sadmac2> ugh, regression.
<Keybuk> actually, it was more the implementation that interested me
<Keybuk> you added a control message
<Keybuk> initctl sends that control message to upstart
<Keybuk> which handles that control message
<Keybuk> by ...
<Keybuk> sending itself the TERM signal
<Keybuk> couldn't you have just made initctl send the term signal? :p
<Keybuk> case 'u':
<Keybuk>   kill (1, SIGTERM);
<Keybuk>   break;
<sadmac2> I think we figured there would be a better way than self-terming to handle that case down the road
<Keybuk> so you figured it'd be better to add API without knowing what you wanted? :p
<Keybuk> giving yourself the interesting "socket goes away during a call" problem <g>
<Keybuk> I'm amused, rather than anything else, btw :)
<sadmac2> meh
<Keybuk> "I would not have done it that way" <g>
<sadmac2> I learned the control system
<sadmac2> ultimately I think its a product of not looking at both ends
<sadmac2> I wrote the telinit bit
<sadmac2> then realized that once I got the message in init there wasn't much interesting to do with it
<Keybuk> :D
<Keybuk> that sounds like my one attempt to sleep with a woman
<Keybuk> once I got it in, there was nothing else useful to do
<sadmac2> ...wow...
<sadmac2> I should write that down somewhere
<suihkulokki> http://www.internettablettalk.com/2008/09/18/osim-maemo-developer-session/
<suihkulokki> something familiar on the slide :)
<sadmac2> HEE
<sadmac2> *hee
<sadmac2> capslock makes everything awkward!
<keesj> indeed 
<keesj> As I understand they will try to go for the native upstart mode
<ion_> capslock makes everything awesome!
<Keybuk> bah, there was a bonus available for replying "INDEED" there ;)
<ion_> I didnât dare to type that in caps, though. :-)
 * keesj was at the maemo summit
#upstart 2008-09-24
<sadmac2> Keybuk: Have we decided what kind of info pid 1 will provide? i.e. is it just a feed of signals and other happenings or is it a Start-Stopped-Failed-Restarting kind of abstraction?
<Keybuk> probably the same basic signals we have today
<Keybuk> starting (lower left edge)
<Keybuk> started (upper left edge)
<Keybuk> stopping (upper right edge)
<Keybuk> stopped (lower right edge)
<Keybuk> where stopping and stopped will include properties containing exit codes, signals, output, etc.
<sadmac2> yes. that's good
<sadmac2> that's more useful to people who want to use pid 1 directly without the state service
<sadmac2> and it makes it easier to manage the state service itself
<sadmac2> BTW I think pid 1 should handle respawning transparently
<Keybuk> respawning is interesting
<Keybuk> as to whether or not you go through the levels
<sadmac2> it can be reflected in the state machine, but it means 3 states for a single job (one for running, one for trying to respawn, one for either of the above)
<Keybuk> that's how I used to have it
<Keybuk> but I couldn't find any reason for having that magic third state
<Keybuk> at the end of the day, if you're depending on a service, and that service is restarted
<Keybuk> most likely, you have to be restarted too
<sadmac2> with deps, there could be a serious falldown if that happens
<Keybuk> d-bus crashes
<Keybuk> and gets respawned
<sadmac2> whole system bounces
<notting> d-bus is not allowed to crash. especially if it's in the kernel
<Keybuk> it has to bounce though
<Keybuk> if d-bus crashes, we really do have to restart everything that depended on it
<Keybuk> it might be scary behaviour, but it's correct
<notting> every time that gets brought up to the d-bus developers, they just say to punt. and well, if we put the system bus in the kernel and make it panic() on exit, that works around the issue
<Keybuk> I don't think that's relevant though?
<Keybuk> it's still a good example
<Keybuk> if X crashes, we probably have to restart everything that depended on it
<sadmac2> Keybuk: if the respawn is in the state machine its a good example of the case for transition actions
<sadmac2> transition A => TryRestartA on failed($OUR_SERVICE_HANDLE)
<sadmac2> Mmm... runtime type definition
 * sadmac2 loves Ruby
<ion_> Ruby for the win.
<sadmac2> notting: what is the state of the kernelspace dbus? I was at the talk, but I hadn't slept much and was only intermittently conscious.
<notting> not really that close to done
<sadmac2> hm
<notting> sort of a proof-of-concept
<keesj> if (dbus in kernel) then me search other job
<sadmac2> keesj: wth kind of programming language is that? Visual Caveman?
<keesj> human2.0
<keesj> (based on lua)
<sadmac2> oic
<keesj> well perhaps it can beat sysfs and netlink.
<sadmac2> Keybuk: I'm hitting the old question: User starts X, event says to stop it. We do ??
<sadmac2> and its more complicated than we think
<sadmac2> stop on dont-particularly-feel-like-spending-resources-on-this // User probably takes precedence
<sadmac2> stop on disk-we-were-using-just-up-and-vanished // User can probably shove it
<sadmac2> nvm doing it wrong
<Keybuk> event can't say to stop it?
<Keybuk> we removed "stop on"
<sadmac2> Keybuk: yes. Just realized that
<Keybuk> the condition in which X is permitted to be running can become false
<Keybuk> so obviously, it has to be stopped ;)
<Keybuk> the user can only start it while that is true anyway
<Keybuk> when I realised we'd solved that old issue, I cried
<Keybuk> with joy
<sadmac2> Keybuk: I think instead of 'until', we should just say that anywhere you can use a state name you can also say (a..b) where a and b are events
<Keybuk> why is .. better than a keyword?
<Keybuk> how does that work when a contains multiple parameters?
<sadmac2> (a b c .. d)
<Keybuk> why is ".." better than "until" ?
<sadmac2> its better because its valid /anywhere/ a state is
<sadmac2> when foo and (a .. b) on bar
<Keybuk> when foo and (a until b) on bar
<sadmac2> you can wordify it yes
<sadmac2> but that is different than on a until b
<Keybuk> was from a until b
<sadmac2> you wrote on a until b on the whiteboard at one point
<Keybuk> this is just syntax though
<Keybuk> I'm more interested in how it works atm
<sadmac2> true
<sadmac2> Keybuk: issue with your assertion about the dependency:
<sadmac2> wait...
 * Keybuk sits down and starts singing about gold
<sadmac2> ok
<sadmac2> we're good
<sadmac2> I need to teach my brain to trust previous results
<sadmac2> after I implemented that instance hack for states in 0.5 I think I twice had to re-prove to myself that it would work
<Keybuk> what was the issue?
<sadmac2> what if the user starts service A, which auto-starts its dependency service B, and then the user tries to stop service B
<Keybuk> then A would stop
<sadmac2> yep
<sadmac2> actually, a nice "WARNING: YOU ARE A MORON" might be nice.
<ion_> Didnât read the discussion yet, but such a warning is always nice. :-)
<Keybuk> well, we could do quite interesting things
<Keybuk> # stop apache
<Keybuk> must also stop tomcat, continue? [y/n]
<Keybuk> # stop -f apache
<Keybuk> obviously we'd only do that if apache was making a depender's state false
<Keybuk> if apache depended on tomcat, we wouldn't bug
<sadmac2> So from what I have we have 3 reasons a service can start (An event the service listens for, Dependency, or User saying go) and 2 it can stop (lost dependency, User saying stop)
<Keybuk> err four
<sadmac2> what's 4?
<Keybuk> dependant state becoming true, and auto
<Keybuk> event while dependant state is true
<Keybuk> depended on by another service while dependant state is true
<Keybuk> user saying so while dependant state is true
<sadmac2> Keybuk: reason 1 and 2 are the same in the current abstraction (You'll recall epsilon events?)
<sadmac2> my terminal fails at unicode today or I'd use an actual epsilon
<sadmac2> É
<sadmac2> there we go
#upstart 2008-09-25
<ion_> http://heh.fi/tmp/panorama-test/
<nach> hi can u explain me : start on stopped rcS ?
#upstart 2008-09-28
<kaushal> hi
<kaushal> when i edit any files in /etc/event.d/*
<kaushal> what i have to run after that to update
<ion_> If your inotify is working, nothing.
<kaushal> ok
<kaushal> ion_, how can i check whether my inotify is working or not
<ion_> If youâre running a kernel image from any Ubuntu release shipping Upstart, you have a working inotify.
<kaushal> oh ok
<kaushal> is there a way i can find out on the Ubuntu Server
<ion_> If you have /proc/sys/fs/inotify, itâs working.
<kaushal> ok
<kaushal> ion_, its there
<kaushal> I find it it has a directory
<kaushal> max_queued_events  max_user_instances  max_user_watches
<kaushal> ion_, for example if its not there how can i update /etc/event.d/
<ion_> Some version of Upstart gained functionality to reload the job directory on signal, HUP perhaps. The version might have been 0.5.
<kaushal> ii  upstart        0.3.9-2        event-based init daemo
<ion_> See https://launchpad.net/upstart/0.5/0.5.0
<kaushal> ion_, I am running 0.3.9-2 version
<ion_> Yes
<kaushal> on ubuntu 8.04 server
<kaushal> ion_, can you please explain me about those 3 files
<kaushal> max_queued_events  max_user_instances  max_user_watches
<ion_> Nothing except whatâs obvious from the filenames.
<kaushal> ok
<ion_> For more info, please look it up with Google or something.
<kaushal> ion_, i have another query how can i know what all services has been started on Ubuntu Server
<kaushal> I have been using Gentoo and Redhat
<kaushal> on Gentoo its rc-status and on Redhat its service --status-all
<kaushal> whats on Ubuntu
<ion_> Almost all of the services in Ubuntu are still started using sysvrc, which doesnât have a consistent method for querying the status. For instance, pgrep -l sshd lists whether sshd is running. As soon as the ssh service is migrated to an Upstart job, both âinictl listâ and âinitctl status sshâ should list its status.
<kaushal> ok
<kaushal> ion_, please give me a moment
<kaushal> initctl: Unknown job: s
<kaushal> initctl: Unknown job: ssh 
<kaushal> initctl: Unknown job: sshd
<kaushal> :(
<AlexExtreme> As soon as the ssh service is migrated to an Upstart job, both âinictl listâ and âinitctl status sshâ should list its status.
<AlexExtreme> read properly what ion_ said. "pgrep -l sshd lists whether sshd is running"
<kaushal> AlexExtreme, ok
<kaushal> AlexExtreme, Thanks 
<kaushal> Just curious to know when will ssh service is migrated to an Upstart job
<pbn> Hello, how do I tell upstart that my default runlevel is not 2 but 3 ?
<keesj> pbn: edit inittab  (look at /etc/event.d/rc-default (that one does some grep magic)
<keesj> hmm I perhap sjust would edit that file :P
<pbn> keesj: thank you
<pbn> yes but that script looks into /etc/inittab :)
<pbn> perhaps is the solution: echo "id:3:initdefault" > /etc/inittab ... ? :)
<keesj> pbn: so I guess that if you have a inittab you should modify it , oterwise it's easyer to changed it in the rc-default 
#upstart 2009-09-21
<twb> Currently "shutdown -r 10" will send a whole bunch of useful wall(8)-like messages to users on ttys.
<twb> But users on a GUI aren't notified.  I need to fix this.
<twb> Is there an alternative to dpkg-diverting /sbin/shutdown and adding a horrible wrapper there?
<twb> I think the "right" thing is for the shutdown(8) source to be changed to generate notification-daemon events if it detects dbus is running, but that's kinda hard for me to do on my own.
<sadmac> twb: that's close to the right thing...
<sadmac> not that I can improve it.
<twb> AFAICT if I don't want to use a wrapper and don't want to HTFS of upstart itself, I need to make a python daemon that starts when the user logs in.  It creates a new /dev/pts/N and adds a record in /var/run/[uw]tmp.  That means that shutdown(8) will write to it.  Then, it relays that information to notification-daemon or something.
<twb> There's a utility called "gshutdown" that seems to be close to what I want, except that it also wants to replace shutdown(8) with itself.
<sadmac> twb: ugh. creating that python daemon and then having it listen for a custom dbus signal and relay that information is probably a tad closer to right.
<twb> shutdown(8) doesn't send a dbus signal
<twb> Not until the reboot/shutdown actually begins -- I need to notify the user at e.g. 5 and 10 minutes beforehand, so they can save their work
<twb> This is basically for workstations that have a curfew, so they automatically shutdown at e.g. 9PM each night.
<sadmac> twb: you should use shutdown -r now from some other script then
<twb> You mean, from a wrapper script that uses e.g. zenity to manually warn the user in advance?
<sadmac> yes
<twb> That is plan B, because it's bloody awful.
<twb> I mean, the script would have to find the user's XAUTHORITY file and DISPLAY and then use them to break into the user's GUI
<twb> (Because the script runs as root.)
<twb> sadmac: sweet, /usr/share/doc/python-notify/examples/test-basic.py gets nearly half the problem solved
<sadmac> interesting... libnotify doesn't have a system-wide notice thingy.
<twb> Yeah, but I can launch it per-user in /etc/X11/Xsession.d/ as long as I can get it to have a pty, since then shutdown(8) will talk to that pty.
<sadmac> cool
<twb> So apparently that clever plan has gone to shit because /var/run/utmp isn't writable by users.
<twb> Or: setgid utmp the python script...
<mgoetze> eh... i'm having a problem with upstart 0.3.9 ... i created /etc/event.d/pleskinstall but i get "status: Unknown job: pleskinstall"
#upstart 2009-09-22
<o_cee> is it possible to to "start on started runlevel 2" in Ubuntu, or does it has to be a job name, "start on started rc2"?
<mgoetze> "in ubuntu" is not a very useful description of what upstart version you are using... but anyway, "started" is only for jobs. you want to read the runlevel(7) manpage.
<o_cee> mgoetze: sorry, old Ubuntu LTS even with Upstart 0.3.9
<o_cee> but yeah, that's what i was thinking as well.. need to make sure the custom jobs are run last, when network is up and so on
<mgoetze> o_cee: well the network should already be up when you enter runlevel 2, so "start on runlevel 2" would do for that
<o_cee> mgoetze: not sure what exactly was missing the last time i tried, but it borked my live production server :)
<o_cee> thought it would be safer to to "on started rc2"
<mgoetze> o_cee: if on the other hand you need syslog and all that, you might want to consider "start on stopped rc2"
<o_cee> mgoetze: hm yeah, stopped rather than started?
<o_cee> "finished" :)
<mgoetze> it's "stopped" in upstart 0.6, tbh i'm not sure such an event exists in upstart 0.3
<o_cee> "The two primary events generated are now simply called started and stopped"
<o_cee> http://www.netsplit.com/2006/12/14/upstart-0-3/
<o_cee> guess that should be it?
<mgoetze> sure, if that's what the blog says :)
<o_cee> but rc2 for example, never goes into "started"? it only finishes and emits "stopped" again?
<o_cee> feels a little weird
<mgoetze> "started" is not a state, it's an event
<mgoetze> "started rc2" is an event that happens very very soon after the event "runlevel 2"
<o_cee> oh, i thought that was "starting", and "started" was when it was all finished.. 
<mgoetze> oh... yeah you might be right
<o_cee> confusing
<o_cee> :)
<o_cee> "The started event is not emitted until the post-start task (described above) has finished"
<mgoetze> the whole sysv-compatibility layer is just annoying :)
<o_cee> indeed
<o_cee> feels like it will be much easier once it's all ported
<o_cee> not a lot of examples now
<o_cee> question is if the rc jobs says "stopped" or "started".. hmm
<o_cee> because once started, initctl list says "rc2 (stop) waiting"
<o_cee> mgoetze: any easy way to find out or test somehow?
<mgoetze> initctl events
<o_cee> will need something to test this on i think.. instead of on the live server :)
<o_cee> oh, whaddaya know.. i actually created jobs for lighttpd locally instead
<o_cee> with a fastcgi job that starts after lighttpd
<o_cee> ok, seems it does: runlevel 2 -> starting rc2 -> started rc2 -> stopping rc2 ok -> stopped rc2 ok
<mgoetze> that sounds logical
<o_cee> yup, guess either one will work then, both "started" and "stopped" should be when it's completely done
#upstart 2009-09-23
<twb> I'm running upstart on a squeeze/sid netbook.  When I reboot, I sometimes get reports of the "rc" job being sent CONT and STOP signals over and over.
<twb> What's up with that?
<ion> http://example.net/ is valid C++. :-)
<Keybuk> sadmac2: http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=02b51df1b07b4e9ca823c89284e704cadb323cd1
<ion> Nice
#upstart 2009-09-24
<damjan> whats the logic behind "stop on ..." in task jobs ?
<ion> It will be stopped on such events.
<damjan> ion: but a task  runs very shortly and that's it
<ion> Thereâs no limit on how long a task can run.
<damjan> hm interesting, when I "telinit S" the shell I invoke the command is not killed
<damjan> *at .. is not killed
<damjan> and I do have "stop on runlevel [S106]" in the agetty job file
<tclineks> can i get upstart to log stdout
<tclineks> not available yet?
<mbiebl> tclineks: add "console output" to you job file
<tclineks> it sounded like that wasn't what I wanted, reading http://upstart.ubuntu.com/wiki/Stanzas
<tclineks> but i'll give that a shot
<mbiebl> tclineks: you mean log to syslog?
<mbiebl> or log file?
<tclineks> mbiebl: anywhere, that would be great
<tclineks> console output, tailing /var/log logs, no output
<mbiebl> no, that's currently disabled
<tclineks> so i lose stdout, no way around that?
<mbiebl> yes
<tclineks> :/
<tclineks> thanks
<ion> Hi Keybuk
<Keybuk> hey
<ion> As you might have noticed, i put the mountall patch to bzr and made a merge request. :-) https://code.edge.launchpad.net/~ion/ubuntu/karmic/mountall/fsck-locking/+merge/12289
<Keybuk> I sw
<Keybuk> I'm not ignoring your patch
<Keybuk> I just had some critical bugs to fix first
<Keybuk> did that upload last night
<Keybuk> next is merging your patch, and adding fsck progress notification
<ion> Iâm sorry if i appeared demanding. That was not my intent. I understand there are more critical issues. :-)
<ion> Howâs the Free World? :-)
<Keybuk> heh, that's ok :p
<Keybuk> things are good
<ion> Ah, i just realized LPC is happening right now. No wonder youâre visiting the Free World. :-)
<Keybuk> indeed
<Keybuk> LinuxCon earlier this week, and now LPC
<Keybuk> hey Casey
<ion> Hi sadmac
#upstart 2009-09-25
<mcarter> hello
<mcarter> I wrote a couple of event.d/upstart scripts, but when i run "start mycommand" the start command says that "mycommand" succesfully started, but the start command itself never returns. Is this normal? (ubuntu 8.04 LTS)
<mgoetze> hm, no, i think start usually returns...
<x-warrior> if i want to add something to be executed after bootchart should I create a new file at /etc/init using start on stopped bootchart? 
<E0F> hi
<E0F> can someone explain me how is determined the events starting order by upstart ? or link me the wiki page which explains it ?
<Keybuk> there is no order
<E0F> so if I wanted to make a deamon start after another I couldn't ?
<Keybuk> of course
<Keybuk> you use the events of one daemon to start the other
<x-warrior> I think you can use the events, like "start on stopped otherone" 
<Keybuk> start on started otherone ;)
<Keybuk> you can also do interesting inverse things
<Keybuk> for example, let's say you have two services
<x-warrior> Keybuk, can i use initctl emit event inside a file.conf 
<Keybuk> jack and apple
<Keybuk> if you want apple to be started before jack, you have two options
<Keybuk> in /etc/init/jack.conf you can put:
<Keybuk>   start on started apple
<Keybuk> BUT
<Keybuk> you can *also* do it the other way, by putting in /etc/init/apple.conf:
<Keybuk>   start on starting jack
<Keybuk> (don't do both :p)
<Keybuk> depends which works better for your model
<E0F> that's an interesting system
<Keybuk> x-warrior: you can, though remember that you already have four events "for free"
<Keybuk> for /etc/init/jack.conf you have
<Keybuk>   starting jack
<Keybuk>   started jack
<Keybuk>   stopping jack
<x-warrior> stopped, stoping starting started?
<Keybuk>   stopped jack
<Keybuk> exactly
<Keybuk> you can, of course, use initctl emit to add more ;)
<Keybuk> take udev as an example
<Keybuk> udevd has rules files, and those can call initctl emit
<Keybuk> so we actually end up with
<Keybuk>   starting udev
<Keybuk>   started udev
<Keybuk>   block-device-added
<Keybuk>   net-device-added
<Keybuk>   :
<Keybuk>   net-device-removed
<Keybuk>   block-device-removed
<Keybuk>   stopping udev
<Keybuk>   stopped udev
<x-warrior> let's say jack has a "post-stop" if i want to run something after this post-stop is done I need to use initctl emit right? And other doubt, when i need to use exec? :S 
<E0F> Keybuk: i'm having a look on my /etc/init.d/cups, for example if I wanted to make it start after atd, what should I put in it and where ? "start on started atd" ? but where ?
<x-warrior> E0F,  i think after description usually in the begging of the file
<Keybuk> x-warrior: stopped jack is after the post-stop is run
<E0F> ok because if I put it in the start() section this would be executed even if I manually start the event
<E0F> or eventually reload it
<Keybuk> there is no "start" section
<Keybuk> E0F: add it to the existing "start on" clause
<Keybuk> E0F: though I just realised you said init.d not init ;)
<Keybuk> init.d are sysv init scripts
<E0F> i'm on fedora 11 ;)
<Keybuk> you don't get events for sysv init.d scripts
<Keybuk> only for upstart jobs (ie /etc/init/*.conf)
<E0F> there is no /etc/init but scripts like http://pastebin.ca/1579530 in /etc/init.d
<x-warrior> I think i don't understand the mechanism. If jack executed post-stop so he will be stopped, but if he already doing other things and if "the stop on event" are fired so he will interrupt the execution until the start event is fired again?
<Keybuk> I don't understand what you just said
<x-warrior> hehe
<Keybuk> E0F: that's because Fedora have an out of date version of Upstart
<Keybuk> and have not yet switched any of their infrastructure to use it
<x-warrior> Lets suppose the jack has start on HELLO and stop on BYE... when the HELLO is fired he will execute the script [ CODE ] end script. 
<x-warrior> But if in the middle of the code the BYE event is fired, what happens?
<E0F> can you please give me the version number of upstart on your computer ?
<x-warrior> E0F, 0.6.3 here 
<E0F> yeah ok i've 0.3.11 xD
<E0F> think there'll be a newer version of upstart in the next fedora release
<Keybuk> x-warrior: the script will get sent SIGTERM
<Keybuk> E0F: not that I know of, the Fedora/RH guys are hard at work on the next RHEL release
<x-warrior> I must put a stop condition?
<Keybuk> no, it's optional
<E0F> Keybuk: ok, thank you for the info ^^
<x-warrior> I think this is the last question, i read that if any error happens in execution the script will be terminated, how can I debug this? :S 
<x-warrior> There is something wrong with this: http://pastebin.ca/1579599 ? I want when bootchart stop I execute a file... 
#upstart 2010-09-27
<cmatheson> mysql is starting for me at boot time (i'm using a hosted openvz node).  i assume this is because one of the events it depends on isn't started, but i'm not sure how to tell which event(s) it's waiting on.  is this possible?
<cmatheson> oh sorry, i meant to say that mysql is *not* starting at boot time (i have to manually start it)
#upstart 2010-09-29
<wfamy> Hi
<wfamy> I am figthing to start a dialog console script before gdm. actualy the script start and gdm too. I have to crtl alt f  to show my dialog box.
<wfamy> any clue will welcome.
<mbiebl> wfamy: what is your problem? what are you trying to do?
<wfamy> I want my script to end before gdm start.
<mbiebl> start on starting gdm
<mbiebl> should block gdm from being started until your job is finished
<wfamy> I try to add in in /etc/init.d/gdm3 at the second line . My script start but gdm too.
<wfamy> how to block?
<mbiebl> init.d? that is a sysv init script
<wfamy> I am looking for any clue I test lot of thing and ...
<wfamy> still looking for.
<wfamy> I do not understand upstart priority
<mbiebl> is your script an upstart job or a sysv init script?
<wfamy> it is a python script.
<mbiebl> i give up
<wfamy> I am ready to create any thing 
<mbiebl> do you actually use upstart or why are you asking in #upstart?
<mbiebl> which distro?
<wfamy> I ask upstart because I was under lenny and 8.04 ubuntu and everything work well tell in rc.3 and gdm wait.
<mbiebl> sorry, I don't understand you
<mbiebl> you need to ask more precisely 
<wfamy> I am working to update to 10.04 and squeeze and everithing start and may script is waiting on tty1 while gdm is runing 
<mbiebl> for Ubuntu, you best create an upstart job
<mbiebl> for squeeze you best stick to a simple sysv init script
<JanC> you need an upstart job, which goes into /etc/init/ (not init.d)
<JanC> see init(5) for the job file syntax
<mbiebl> JanC: apparenly gdm is started via an sysv init script
<mbiebl> wfamy: so, for ubuntu, create an upstart job and use the start on starting gdm 
<JanC> it's not
<mbiebl> JanC: /etc/init.d/gdm3
<mbiebl> for squeeze, create a sysv init script and add Requred-Start: gdm3 to the LSB header
<JanC> there is no /etc/init.d/gdm3 in a default 10.04 install AFAIK
<mbiebl> JanC: read the backlog
<mbiebl> he apparently tries to update a lenny *and* 8.04 system
<mbiebl> but I might have misunderstood him
<mbiebl> which is quite possible
<wfamy> there is no update my computer are install using FAI
<mbiebl> <wfamy> I am working to update to 10.04 and squeeze and everithing start and may script is waiting on tty1 while gdm is runing
<JanC> well, in 10.04 gdm is started by upstart
<wfamy> We are working to propose 10.04 and squeeze install
<mbiebl> wfamy: as I told you
<mbiebl> for Ubuntu 10.04 create an upstart job
<mbiebl> for Squeeze, use a sysv init script
<wfamy> I am look /etc/init/  script to understand.
<JanC> you may need an extra job for your dialog, or maybe you could add it to the pre-start script for the gdm job
<JanC> an extra job might be cleanest
<JanC> wfamy: and as I said, "man 5 init" will explain you how job files work
<wfamy> Ok I could now search. I will ask later if pb.  thx
#upstart 2010-09-30
<coshx> i'm debugging an upstart conf, but "sudo start myjob" and "sudo stop myjob" are freezing. I can ctrl+c out, but to get back to normal behavior, I have to reboot. the only change in /var/log is to auth.log (because of sudo). strace shows it freezing at "poll([{fd=3, events=POLLIN}], 1, -1", but I'm not sure what this means.
<coshx> I'm guessing that fd is from connect(3, {sa_family=AF_FILE, path=@"/com/ubuntu/upstart"}, 22) = 0 -- is that a dbus socket?
<ion> Please pastebin the config.
<coshx> ion: http://gist.github.com/603892 <-- this is what I had (for debugging). It worked as expected a couple times, but then when I called "sudo stop cruise" it froze. I was debugging by calling initctl reload-configuration and then start/stop
<ion> Your program most likely doesnât behave as âexpect daemonâ expects and the current version of Upstart gets confused.
<ion> Ah, itâs an sh script. Yeah, every external command ran by it consists of a fork and an exec, and Upstart follows the first fork and waits for the second one.
<ion> Better drop the âexpectâ stanza if you donât know *precisely* how the main program behaves regarding forks.
<ion> Upstart 0.10 will handle forking programs much better.
<coshx> interesting. the actual process should daemonize, but I'll remove the expect and see if I get the behavior I want
<coshx> after removing that line, start/stop still freeze -- i'm guessing I have to restart the init process?
<coshx> (the only way I know how to do that is to restart)
<ion> Yeah, the job is a confused state, expecting for the first command ran by the sh script to finish daemonizing. If rebooting isnât a problem, thatâs the fastest way to get Upstart to a good state.
<ion> The fork-following code is a simple initial implementation that only supports two specific use cases (which donât include most sh scripts), and as i said, a much better replacement is in the works.
<coshx> nice, i just don't daemonize the process and don't use 'expect' and it works perfectly! :)  Thanks for explaining to me
<coshx> thanks! btw, when I do console output, should I be able to cat /dev/console and see output of the command? I assume this wouldn't show output from a fork though, right?
<ion> It might be best to log to a file and read that.
<ion> In a future release, the console stanza will support logging.
<ion> The simplest style:
<ion> script
<ion>   exec >/path/to/log 2>&1
<ion>   (the rest)
<ion> end script
<coshx> oh nice. i saw that on the wiki, but didn't realize it directs all output for the script to the logfile.
<anymous> hello, how can i stop an upstart job that is defined as "task"?  the command "stop job" gives: stop: Unknown instance: under Lucid.
<ion> Are you sure itâs running?
<anymous> I think the problem with "tasks" is that they are listed as "stop/waiting"
<anymous> although they have been running (doing their "task").
<ion> Thatâs the point of tasks.
<anymous> this is true for all jobs marked as tasks, like rcS, rc, mountall-shell, ...
<anymous> but some of them have a "pre-stop" section 
<ion> Please see init(5), look up the definition of task under âServices, tasks and respawningâ.
<anymous> I have read the manpage, but it doesn't answer the question how can you invoke initclt so that the pre-stop section is executed.
<ion> If the job has stopped successfully, the pre-stop part has been executed.
<anymous> ok, just do "stop rcS" it does nothing but print "stop: Unknown instance:"
<ion> Yes, itâs not running.
<anymous> arg, so the post-script is never executed and thus quite superfluous, no?
<anymous> IOW you cannot have a task that defines a stop action.
<ion> The post-stop script has been executed when job stopped.
<anymous> i don't think so
<ion> If youâre sure about that, please file a bug report. But iâm somewhat skeptical, since the unit tests should have caught that long before such a bug ever made it into the Ubuntu archive.
<ion> Not to mention that such a bug would probably result in a non-booting system.
<anymous> hm, so how can i invoke the stop action of a task manually?
<ion> You donât really do that directly. You can only tell running tasks to stop, which results in the {pre,post}-stop scripts being executed.
<anymous> but only if the status is running.
<ion> Sure. How would one stop something that is not running?
<anymous> right, you said that.
<anymous> ok, my example: 
<anymous> I have an upstart script that mounts a special directory
<anymous> it seems i cannot use stop(8) to invoke the stop action of that job
<anymous> because the status after boot of that job is stop/waiting
<anymous> although of course the directory is mounted
<ion> foo.conf:
<ion> pre-start exec mount /foo
<ion> post-stop exec umount /foo
<ion> No task
<anymous> ah! no task, alright, i think i have to try that.
<anymous> would it work with  script sections, (script, pre-stop)?
<ion> Task means you want everything to run when started, including the {pre,post}-stop scripts at the end.
<ion> pre-start script â¦ end script, post-stop script â¦ end script
<anymous> thanks for pointing that out, will try it.
<ion> Service means your job goes to a certain state (such as directory mounted or daemon running) when started and only does any stop actions when something external causes it to stop.
<anymous> does a service not always require a daemon, a running process?
<ion> Itâs optional
<anymous> ok, give me a few reboots...
<anymous> no joy, i removed the "task" but still cannot invoke the stop action
<ion> What does âstatus jobnameâ print? What appears in syslog when you run âstart jobnameâ?
<anymous> status: stop/waiting, start gives: start/running, process 2079
<mbiebl> anymous: please pastebin your current job file
<anymous> not familiar with pastebin :-(
<ion> There probably should be no process ID if thereâs no main process.
<ion> And there shouldnât be a main process in your job.
<anymous> right, theres no process running after the mount
<anymous> but i think it's similair to rcS, you can't run "stop rcS"
<ion> No, more like apport
<mbiebl> http://lmgtfy.com/?q=pastebin
<anymous> ok, when I do "stop apport" it also gives: stop: Unknown instance:
<anymous> mmbiebl: thanks ;)
<ion> Thatâs because you have apport disabled. The structure of the job should be similar nevertheless.
<anymous> http://pastebin.com/ZfP8mSAu
<ion> Replace âscriptâ with âpre-start scriptâ
<ion> You donât want a main process for that job.
<ion> Also, thereâs a space between ârunlevelâ and its parameter.
 * anymous is correcting
<anymous> http://pastebin.com/nxQcu7Vh but still ... status: stop/waiting
<anymous> when you enable apport, its status is running after boot?
<ion> Yes
<anymous> without a process?
<ion> Yes
<anymous> thanks for you patience, somehow the status of my job (stop/waiting) is wrong after boot, but i've found a workaround for that.
<BLZbubba> i like the verbose boot option; but is there a way to have upstart log to a file?  /var/log or /tmp or whatever?
<BLZbubba> i am using a console-less machine and it fails to start everything
<BLZbubba> after awhile i can start the network by hand and run "init 2"
<BLZbubba> but this is not ideal
<rawler> has "initctl events" been remove to trace upstart events?
<rawler> ergmh, sprinkle the last statement with some grammar, please..
<BLZbubba> heh
<mbiebl> BLZbubba: w/r/t logging, no there is not
<indygreg> is there any workaround for the non-valid PID stuck in the killed state? I think it is bug #406397. i.e. I want to force mark a job as stopped/having no PID
#upstart 2010-10-02
<gino_> Hello, after added my script to /etc/init what else do I have to do to make it run on startup?
<gino_> I have placed my script in /etc/init/ but upstart doesn't seem to run it, ether with "start myscrip" or when ubuntu start. Help?
<mbiebl> gino_: pastebin your script
#upstart 2011-09-27
<Epeli> Is it safe to install upstart to Debian Squeeze using apt-get?
<Epeli> I have a clean Squeeze installation and I would like to use upstart instead of init.d scripts
<jhunt> Epeli: I wouldn't like to say. The version in debian is very old. Keybuk was/is going to update it I believe.
<Epeli> hmm, maybe I'll just go for Ubuntu
<bwlang> is it a bad idea do something like this? runlevel RUNLEVEL=1 PREVLEVEL=2; runlevel RUNLEVEL=2 PREVLEVEL=1 to simulate a reboot (without unmounting the filesystems?)
<JanC> that doesn't exactly simulate a reboot...
<simensen> I have a legacy app that has "server.sh start" and "server.sh stop" functionality that manages the starting and stopping of a java application (somewhere in there it launches java into the background with & ). Is there an easy/straightforward way to deal with this using upstart? Or do I have to rewrite the script?
<ion> Move the pre-start stuff from the script to a pre-start section, change âjava â¦ &â to âexec java â¦â, that should be about it.
<simensen> what would cause "sudo start myjob" to just hang? it never returns to the command prompt. if i control-c ( eventually ) and try to run it again it says it is already started.
<simensen> and how do i debug these things? i can't seem to be getting any output anywhere. not sure what is going on. as far as i can tell, the code i'm putting in script and/or exec doesn't actually get run.
<SpamapS> simensen: if your job is mentioned in an 'and' condition in some other job, then start will hang until the other conditions are met.
<SpamapS> simensen: console output will spit out the program's stdout/stderr on /dev/console
<SpamapS> simensen: you can also use  exec yourprogram | logger .. but that gets tricky with expect fork
<simensen> yeah, this is getting ridiculous. i thought upstart was supposed to be simple and wanted to try it out but i've already spent a few hours on it and basically haven't gotten anything to work yet. 
<JanC> upstart is simple in some ways, but complicated in other ways  âº
<simensen> :)
<simensen> well, now it just is hanging on my process.
<simensen> does it get confused sometimes?
<simensen> because it seems tow ork for a bit, then i think i've messed something upâ¦ but if i just rename the script from mysample.conf to mysample2.conf and run it, mysample2.conf runs just fine, but mysample.conf won't run anymore.
<JanC> yes, currently (at least until Ubuntu 11.04) it gets confused if services fork more or less times than it expects
<simensen> how do you recover from that?
<simensen> can you reset it short of restarting the box?
<JanC> there is a hack that involves attempting to create a process with the PID that upstart expects to see...
<JanC> I think in your case it might be best to create an upstart job that has no exec stanza though
<simensen> how so?
<JanC> no main script/exec stanza I mean
<JanC> call the server.sh script from the pre/start script/exec stanzas
<simensen> hm.
<JanC> pre/post start/stop
<JanC> I think there is an example in the cookbook about that
<simensen> which is the best place to run each? i thought i needed at least an exec or script?
<JanC> not needed
#upstart 2011-09-29
<axisys> how do I make sure a process does not start at reboot?
<axisys> with init.d/ I used to run update-rc.d -f proc remove
<axisys> is there something like this with process starts by upstart ?
<axisys> or do I manually edit the /etc/init/proc.conf ?
<axisys> /etc/init/foo.conf 
<axisys> do I just comment this on /etc/init/foo.conf so it wont start at boot?
<axisys> start on filesystem or runlevel [2345]
<axisys> or there is a more automated way of doing it?
<axisys> found my answer
<axisys> http://upstart.ubuntu.com/cookbook/#disabling-a-job-from-automatically-starting
<coot> Helo, I'd like to know when ubuntu configures network interfaces.
<coot> The reason is that I have a simple firewall script (based on iptables) which I'd like to run before
<jMCg> co..
<ion> coot: interfaces(6)
#upstart 2011-09-30
<bkad-work> I have a question about the reload command in upstart
<bkad-work> i'm using upstart to manage a java process which  reloads it's config when it gets SIGHUP
<bkad-work> i thought `initctl reload java_thingy` would send SIGHUP to it
<bkad-work> but it seems to log "java_thingy main process (12830) killed by HUP signal" "java_thingy main process ended, respawning"
<bkad-work> and spawns a duplicate process, leaving two java_thingies running
<bkad-work> doing `kill -HUP pid` seems to do the trick, but I'd like to do it through upstart
#upstart 2012-09-25
<six86> hi
<six86> one question to upstart: i want a job that starts other jobs for convenience, but it doesnts work. Can someone help?
<SpamapS> six86: perhaps you could share the job as you have it now?
<six86> i have around 5 jobs, all part of the whole system. to start this jobs i want one that starts them all
<six86> http://pastebin.com/LshrGktj
<six86> it seems as if the jobs are executed, but i cannot check status nor stop them bz name
<six86> by name
<SpamapS> six86: start on startup is wrong, btw
<SpamapS> six86: that event is emitted before filesystems are mounted, before networking is up..
<six86> the start on is currentlz not important and will be changed later. The interesting question is, if i can start multiple services in one job and the track them individually with start/stop/status 
<SpamapS> six86: ok, you're kind of doing it backwards
<SpamapS> six86: instead of putting a bunch of starts in that job...
<SpamapS> six86: (which should work)
<SpamapS> six86: how about changing the other jobs to 'start on starting meta-aggregate-job-name'
<SpamapS> six86: and then 'stop on stopping meta-aggregate-job-name'
<SpamapS> six86: then you don't even need a script section
<SpamapS> six86: it just becomes a job to help start/stop them together
<six86> thats a good idea, thx. I will try that tomorrow
<cubicool> Is there a way in upstart to run a curses-based application before lightdm ever starts? I realize I need to make my curses app be a dependency of lightdm, but I can't actually get my upstart job to "grab the foreground", so to speak.
<cubicool> I know everyone will say "why", but I need to accomplish this in a corporate setting; a few pre-X functions must be executed on the employees first boot.
<benzittlau> hey, I'm trying to get the PID of the current process inside a pre-stop block
<benzittlau> i
<benzittlau> is there a straightforward way to get that without having to write the PID to a file?
<SpamapS> benzittlau: status
<SpamapS> benzittlau: it is every easy to parse
<SpamapS> cubicool: if you want it to grab the actual console, you need to make it 'console owner'
<SpamapS> cubicool: and you have to make *sure* it is the *only* console owner
<benzittlau> SpamapS: happen to know of any snippet for parsing out the PID?  I'm sure I could figure it out, but it would save me some time
<SpamapS> cubicool: 'start on starting lightdm' should be enough, but you may have to also add in some stuff about plymouth to make sure you get the console
<SpamapS> benzittlau: x=$(status); pid=${x##*, process}
<benzittlau> thanks!
#upstart 2012-09-26
<econnell> i'm trying to create a config for apache traffic server, and it behaves a bit odd.  you exec a program called traffic_cop which then spawns 2 other processes.  Is there a way to wait for all processes within the process group to terminate before declaring the job as stopped?  (running upstart 1.5-0ubuntu7)
<SpamapS> econnell: does traffic_cop stay resident? if so, thats the process/group that will be tracked
<econnell> yes, it does stay resident and it does not daemonize (i.e. no expect statement in the config)
<SpamapS> then that should behave as you'd expect.. kill to the process group
<econnell> is that the default behavior?  to wait for all members of the process group before stopping?
<econnell> yes, i see the kill signal is sent to the group, but it appears to only wait for the main tracked process to stop rather than all processes in the group (i think... it's hard to tell)
<SpamapS> yeah I'm tracking down how job_process_terminate is called
<SpamapS> getting into libnih at that point
<SpamapS> econnell: ultimately traffic_cop should be killing and waiting for its own children...
<SpamapS> econnell: this is just a question of cleaning up and timing I guess
<SpamapS> econnell: it looks to me like only the main process would be waited on
<SpamapS> econnell: I believe if traffic_cop exits without waiting for its children, pid 1 will inherit them as zombies and then they'll be cleaned up in the normal zombie cleanup way
<econnell> yeah... that's happening, the actual problem i'm trying to solve is with restarting the job... the timing causes it to occasionally try to start traffic_cop before the children are killed, which causes some other weird problems
<econnell> is there a way to determine what the pgid that's being tracked is in a script?  if so, i could hack a post-stop script that waits i suppose
<SpamapS> econnell: pgid == parent pid
<SpamapS> econnell: post-stop doesn't get called in the 'restart' action btw.. 
<econnell> interesting... i assumed restart == stop, then start... 
<econnell> SpamapS: are you sure about that?   during restart i see: init: Handling stopping event
<SpamapS> econnell: stopping yes, but I don't believe post-stop is the next step
<SpamapS> restart is a little wonky
<SpamapS> pre-stops aren't run
<econnell> SpamapS: alright... i got it working... but this is kinda hackish... can i suggest a feature to have an option to wait for everything in the process group to die?
<SpamapS> econnell: it really is a corner case. Ideally the *parent* would not die till its children do
<SpamapS> econnell: sounds mostly like a bug in traffic_cop's signal handler
<econnell> yeah.. i'm pestering the traffic server guys about it now too :)
#upstart 2012-09-27
<j4m3s> i'm trying to set the priority of a process in my upstart script with nice and it doesn't appear to be taking
<j4m3s> where does one typically put the 'nice <priority>' setting in an upstart script?
<SpamapS> j4m3s: its a root level keyword, so just put it anywhere outside a script stanza.
<MFen> i'm trying to set up an upstart job for bip
<MFen> i've carefully studied http://upstart.ubuntu.com/cookbook/#implications-of-misspecifying-expect and even did the test described here.. http://upstart.ubuntu.com/cookbook/#how-to-establish-fork-count which demonstrated that bip forks twice (is a daemon)
<SpamapS> MFen: ^5 for reading the cookbook. :)
<MFen> so i'm using expect daemon. according to that chart, i shouldn't be getting a hang (even if i'm wrong), but i am
<MFen> any double-secret troubleshooting tips available? :)
<MFen> SpamapS: ltns :) ... i think we used to chat in #linux
<MFen> loooong ago
<SpamapS> or #linuxhelp
<MFen> yeah
<SpamapS> which I still lurk in, just in case somebody wants to reminisce ;)
<SpamapS> MFen: do you have the output of your fork test handy?
<MFen> no but i'll run it again
<MFen> well, yeah. the output was "2" :)
<SpamapS> I mean the strace.log
<MFen> sure
<SpamapS> the grep for fork/clone may be wrong
<MFen> ok
<SpamapS> Have seen at least one program that does clone that is actually doing threads
<MFen> oh, heh. gotta log in to irc directly if i'm going to do this. brb
<SpamapS> MFen: also, about 90% of daemons fork way too soon anyway, and so the 'expect fork|daemon' is actually not really accurate.. does bip have a "run without daemonizing" mode?
<SpamapS> MFen: just use pastebinit ?
<MFen> bip has a -n
<MFen> i'll pastebin it, but bip is an irc multiplexer that i'm using right now
<SpamapS> Oh hah ok
<SpamapS> MFen: hang on tho
<MFen> k
<SpamapS> MFen: consider just using -n
<MFen> tried that too (with no expect)
<MFen> iirc what happens in that case is it hangs on stop
<SpamapS> MFen: the only drawback to that over expect fork/daemon is that the job will be considered "started" as soon as it forks/execs bip
<MFen> it was doing a weird thing where it would hang, but stop anyway
<SpamapS> MFen: does it not respect SIGTERM ?
<MFen> so i ^C then stop again and it says it's already stopped
<MFen> it does when i run it straight from a command line
<SpamapS> ^C is SIGINT , which is often handled differently than SIGTERM, which is what upstart sends before SIGKILL
<MFen> oh i see. ok, i can find out what SIGTERM does
<MFen> brb
<mfen>  alll right
<mfen> kill -15 works fine on bip -n
<SpamapS> alright
<SpamapS> mfen: then the only other thing to consider is that things that want to 'start on started bip' may not actually be able to contact bip's network port... so if you want to support that type of behavior, you have to add a post-start which polls bip until its actually available.
<SpamapS> mfen: note that even sshd suffers from that race.. so don't feel like you have to add a post-start
<SpamapS> mfen: also test SIGHUP
<SpamapS> mfen: as that is what reload sends
<mfen> the strace.log is 22k lines
<SpamapS> mfen: pastebinit < strace.log ;)
<mfen> did not know that
<SpamapS> its a beautiful tool
<SpamapS> wish we had it 10 years ago in #linuxhelp
<mfen> kill -HUP has no effect
<mfen> hmm. i got http://paste.ubuntu.com/ as the output of pastebinit
<mfen> i'm guessing that was supposed to have a unique identifier in it
<mfen> i'll just put it in dropbox
<mfen> https://dl.dropbox.com/u/19400544/goonmill.org/strace.log
<mfen> bah, that can't be right
<SpamapS> mfen: its possible the pastebin didn't like 22k lines ;)
<mfen> yeah
<mfen> dropbox doesn't either afaict
<SpamapS> 21730 clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0xf72f2968) = 21731
<SpamapS> Thats a thread
<mfen> ok
<mfen> so is this actually a fork?
<SpamapS> Probably need to update the cookbook
<SpamapS> mfen: no
<mfen> the thing is, i've tried all three
<SpamapS> well it might be
<SpamapS> I have never understood how clone turns into fork
<SpamapS> it does.. sometimes.. but ... whenever I see it.. expect doesn't work. I think ptrace gets confused
<SpamapS> mfen: you're better off with -n
<mfen> all right, here's the whole bip.conf now:
<mfen> setuid cdodt
<mfen> chdir /home/cdodt
<mfen> exec bip -n
<mfen> that hangs when i start
<mfen> even simpler version. just this: exec sudo -u cdodt -i bip -n ... also hangs when i start
<mfen> i tried strace -fF -p 1 ...... i'm seeing read(3, ...)  = -1 EAGAIN 
<mfen> lots of those repeated
<mfen> that's when i try to start bip
<mfen> custom upstart jobs seem to work fine, e.g. "exec sleep 10000" works as i expect it to work
<mfen> this is a virtual server, i've seen some suggestions that virtual servers have issues, but nothing else is having an issue but bip
<mfen> i'm going to try wrapping it in a script, perhaps that script will behave better
<mfen> all right, here's a possible clue.. every time i run bip status, it gives me the status for process 4667
<mfen> i think it started with that pid at some point when i was working on this yesterday
<mfen> in all the attempts since then, status bip hasn't looked at a different pid
<mfen> i'm rebooting to see if i can clear it
<mfen> ahhhhhhhhhhhhhhh it works now
<mfen> ok so here's what i think happened: i started bip with no expect yesterday. it did its thready-fork thing, and upstart lost track of it, but remembered the pid of 4667
<mfen> after that point, upstart was trying to operate on that pid and getting confused
<mfen> this looks like a bug in upstart to me.. i don't see any way to truly clear the status of a job
<MFen> so there ya go.
<SpamapS> MFen: thats a well known, very old bug
<SpamapS> :(
<SpamapS> MFen: if you get expect wrong, you get a mis-remembered pid
<SpamapS> MFen: and as yet, there's no way to tell upstart to forget said pid
 * jMCg subscribes to upstart-devel@
#upstart 2012-09-28
<MFen> SpamapS: ok, at least it's known. when you say "no way".. there is at least one way, which is to reboot. anything i can do short of that? where are pids actually "remembered"?
<SpamapS> MFen: yeah, you can exhaust pid space
<SpamapS> MFen: they're in RAM
<MFen> in init i assume
<SpamapS> yeah
<MFen> need an initctl cleanup or something
<SpamapS> MFen: there's a script attached to the bug which will loop fork/wait until the desired pid appears, then lets upstart kill it
<MFen> no reason for upstart to track a pid that doesn't exist
<SpamapS> Yeah I agree
<MFen> oh heh, that's a clever bit of evil
<SpamapS> its by far the highest "Heat" bug on the tracker
<SpamapS> bug 406397
<MFen> ty
<SpamapS> MFen: add yourself as affected. Its basically a vote for what gets worked on by jodh next :)
<SpamapS> 51 affected so far
<MFen> will do
<SpamapS> and its been known for 3+ years
<SpamapS> MFen: the only reason it hasn't received love is we keep thinking ther will be a move away from ptrace to something less weird
<SpamapS> but then something else comes up..
<SpamapS> like logging, or the need to re-exec without forgetting, ironically, all the pids
<MFen> just check every 10 loops to see if all the pids still exist, and remove the ones that don't. the solution doesn't need to be fancy
<MFen> 52
<MFen> wish you could +1 comments on bug trackers. or at least on launchpad
<SpamapS> MFen: I agree, or just check all the pids with kill -0 when reload-configuration is asked for
#upstart 2012-09-30
<j4m3s> SpamapS, http://pastie.org/private/thxcuoxiq2lcrj3jrug here's what i have but it's not setting the priority properly, at least top shows -10 instead of -11
<j4m3s> anyone familiar with nice'ing a process that daemonizes on startup?
#upstart 2013-09-23
<ricicle> So I have an upstart job that is dead but the pid is hanging around. How to ind location of pid file please?
<ricicle> *find
<ricicle> no takers? Reverting to classic start/stop script then.
<leandrosansilva> Hello to all. I've setup a service which calls a bash script and the script starts normally when I call service start, but when I call service stop, I get the following error: 
<leandrosansilva> stop: Connection was disconnected before a reply was received
<leandrosansilva> and the prompt blocks
<yann2> hello! Small logging question: you can not choose where your daemon logs, can you?
<bmfurtado> Hello, I've been looking at the cookbook but can't seem to find an answer to this: if I need the tracked PID of a service on a pre-stop script, what would be the cleanest way to get it? Is there a variable with this provided by upstart or do I have to use awk to parse the output of status?
#upstart 2013-09-25
<twb> Has anybody already written a script that can look at /etc/init and spit out a graphviz (or similar) dependency DAG ?
<stgraber> twb: like initctl2dot (which we ship by default with Upstart)?
<twb> I guess so; I'm still on Ubuntu 10.04 and I hadn't dpkg -L'd anyway
<stgraber> ah, not sure if we already had it back then, but I know it's been around for a while now
<twb> I'll just pull it from HEAD and see if it works on its own
<stgraber> if you take the one in trunk, I ported it to python3 which I don't believe we had in 10.04, so I doubt that'll work
<stgraber> taking an older revision should be fine though
<twb> OK
<twb> http://archive.ubuntu.com/ubuntu/pool/main/u/upstart/upstart_1.8-0ubuntu1.dsc should be old enough to be using python2 ?
<stgraber> there's a pretty good chance 1.8 already had the python3 rewrite as my branch got merged in November 2012
<stgraber> I'm sure that 1.5 is a safer bet
<twb> Hm, I can't see an initctl2dot in that tarball
<stgraber> twb: looked under scripts/ ?
<twb> I did find -name \*dot
<stgraber> ah, look for dot.py then
<twb> Ah found it
<twb> I could just run the script on another, newer host
<twb> ba-bow: $ ssh spoon initctl show-config -e --err--> initctl: invalid command: show-config
<stgraber> ah, looks like upstart under 10.04 is a bit old for that command...
<stgraber> so probably easier to get a 12.04 machine with the same set of jobs and run initctl2dot on that one
<twb> What this is all in aid of, is to work out why squid & an in-house daemon both fail to start sometimes when the server is rebooted
<stgraber> sounds like a race condition between the network interfaces getting configured and the daemon starting
<twb> Which I suspect is because they're trying to bind to an interface that isn't up or resolve a hostname before LDAP or DNS is up or something.
<twb> Looking at the dependency graph seemed like the best first step :-/
<stgraber> 10.04 wasn't great for that, some stuff were switch to upstart, some were still under sysvinit, so things may be a bit random... I did a fair amount of work in 12.04 to try and get all of that a bit saner (though unfortunately it ended up being way too big to backport to 10.04)
<twb> Can you pastebin what initctl show-config -e output looks like?  I can probably mangle that by hand with some sed.  I don't have a newer ubuntu system handy
<stgraber> are squid and your inhouse software using upstart jobs or are they good old sysvinit jobs?
<twb> upstart
<stgraber> ok, what are their start conditions?
<twb> squid is start on runlevel [2345] or net-device-up IFACE!=lo; stop on runlevel [!2345]
<twb> ppcadm is start on runlevel [2345]; stop on runlevel [^2345]
<stgraber> ok, and do those require some special network interfaces to appear? (thinking of bond, bridges, vlan, tunnel devices, ... that kind of stuff)
<twb> That first one looks buggy to me, looks to me like it assumes a single-NIC system
<twb> Lemme pastebin the interfaces(5)
<stgraber> output of initctl showconfig -e on 13.10: http://paste.ubuntu.com/6152669/
<twb> http://paste.debian.net/45811/
<twb> AFAIK we don't have bonding on anything anymore, at least one with no bonding is having startup issues
<stgraber> ok and upstream, staff and prisoner are all aliases for real network interfaces setup through udev?
<twb> Yeah they're renamed from eth0 style names
<stgraber> my current guess is that those appear as standard ethX devices which then get renamed by udev, so you get a first net-device-up event with the wrong name before it vanishes to get renamed...
<twb> Ah.
<stgraber> twb: you could try to get both jobs to do "start on net-device-up IFACE=prisoner" or whatever interface they actually need
<twb> So if I just slap in an "AND net-device-up IFACE=staff AND net-device-up IFACE=prisoner" ?
<stgraber> yep, that'd work, upstart will just wait until it got all 3 events and then will start the service
<twb> I don't really care if they don't start for two minutes or whatever after boot -- plan Z is to just add a great big "pre-start exec sleep 300"
<stgraber> sounds like having upstart wait for the interfaces would be considerably cleaner than a huge sleep in pre-start ;)
<twb> No argument there
<twb> The problem is that atm after a power outage, upstart tries a few times then gives up, end result is they never actually start and then the inmates riot because they can't get their porn.
<twb> I'll do some restarts with extra net-device-up
<twb> Hm, syslog says squid is getting an ABRT.
<twb> (Before I change the start on)
<twb> Ah, the reason squid is crashing is because some fool thought it would be a good idea to make it use a whitelist helper that talks to postgres.  And postgres as at 10.04 is in sysvinit still.
<twb> Fun :-/
<twb> And I'm guessing "start on runlevel [2345]" is when that runlevel *begins*, not when it ends.
<twb> And the ppcadm one is not starting because it needs slapd to be accepting connections before it starts.
<twb> Which is also in sysvinit as at 10.04
<SwashBuckla> Anyone written a rule for when `sudo service <service> restart` is invoked? http://upstart.ubuntu.com/cookbook/#restart
<SwashBuckla> I'm writing an upstart job to daemonize a script, and am struggling to capture when `restart` is called -- what state is the process in?
<SwashBuckla> is there an upstart condition? It's not pre-start or pre-stop
<jodh> SwashBuckla: is the problem that your job is not able to restart the daemon script? Have you read http://upstart.ubuntu.com/cookbook/#expect ?
<SwashBuckla> I can restart it just fine
<SwashBuckla> that works
<SwashBuckla> but I want to capture in the daemons .conf file WHEN that happens, do FOo
<SwashBuckla> Foo*
<jodh> SwashBuckla: there is no "restart" state - using the restart(8) command, the job is restarted whilst retaining its original config. Is this job a system-level one? If so, if you really want the job itself to know it has restarted, your best bet it probably to log something via a pre-start then check that value in the pre-start so you know how many times you've been restarted.
<SwashBuckla> jodh: hmm. OK.
<jodh> SwashBuckla: generally jobs shouldn't care if they have been restarted - they just need to handle that scenario
<SwashBuckla> yeah I'll have to leave some breadcrumbs and look for them
<SwashBuckla> I need to fire off an email in the event that a daemon was restarted, started, or stopped
<SwashBuckla> as I care about the state of a daemon on a headless server
<jodh> SwashBuckla: it would be better then to create a new "monitor" job that specifies "start on (started or stopped)" and does whatever you need.
<PaulePanter> Hi. How do I analyze the startup process of my Ubuntu 12.04 server?
<PaulePanter> Is there an equivalent to `systemd-analyze`?
<jodh> PaulePanter: not atm. I suggest you apt-get install bootchart: http://www.bootchart.org/
<PaulePanter> jodh: Thanks. I already tried it, but it is not conclusive yet as a mdraid resync runs in the background.
<PaulePanter> A little off topic, is there a guide what I can disable on a server (where no graphics is needed for example).
<PaulePanter> I am on Ubuntu 12.04. How do I easily find out if there are Upstart scripts in later releases for packages not shipping them?
<PaulePanter> Collectd is installed and does not seem to have one.
<PaulePanter> Mark Brooks published one here http://blog.loadbalancer.org/upstart-script-for-collectd/ and I wonder if Ubuntu already ships one so I can compare them.
<jodh> PaulePanter: Some of this is indeed rather off-topic (you are probably better off asking some of this on #ubuntu-server in future). However, you can use http://packages.ubuntu.com to query package contents for any ubuntu release. Or use 'apt-file list <pkg>' on a newer version of Ubuntu (you'll need to 'apt-get install apt-file') to see what files a package ships.
<PaulePanter> jodh: Thanks. (That method is not very user-friendly though. ;-) )
<jodh> PaulePanter: ?
<PaulePanter> jodh: Looking at http://packages.ubuntu.com/saucy/amd64/collectd-core/filelist and finding out that there is an upstart file, I would not be able to easily check the content of the file or copy it.
<PaulePanter> In the end I would need to download the deb file and extract it, if I am not mistaken.
<PaulePanter> Or are all packageâs source files tracked in Launchpad in Bazaar?
<jodh> PaulePanter: yes, you can access the files on bzr: http://bazaar.launchpad.net/~ubuntu-branches/ubuntu/saucy/collectd/saucy/files
<PaulePanter> jodh: Awesome! Thanks. That method is easy!
<PaulePanter> Though in this case I could not find the upstart job.
<PaulePanter> http://bazaar.launchpad.net/~ubuntu-branches/ubuntu/saucy/collectd/saucy/files/head:/debian/
<glisignoli> Hello, upstart newbie here. I have a server in single user mode and want to disable the starting of an upstart service for a few restarts, then enable it again.
<glisignoli> *upstart 0.6.5
<glisignoli> :(
#upstart 2013-09-26
<ion> Please see the cookbook, âdisabling a job from automatically startingâ.
<ion> Oh, he left.
#upstart 2013-09-27
<PaulePanter> On a server, should bootchart stop when the last daemon is setup correctly?
<PaulePanter> â¦ that means in a working state?
<jodh> xnox/stgraber: hi - could you take a look at (and have a test of) https://code.launchpad.net/~jamesodhunt/upstart/bug-1227212/+merge/187844 ?
<xnox> jodh: i have been actually reviewing it at the moment.
<jodh> xnox: thanks!!
<jodh> xnox: thanks for the merge. I've got a minimal follow-on MP: https://code.launchpad.net/~jamesodhunt/upstart/bypass-quiesce-logic-for-pid1/+merge/188089
<xnox> jodh: ack, will look into it. but not today unfortunately. close to EOD.
<jodh> xnox: sure, NP.
#upstart 2014-09-22
<mlindner> Does anyone know how to feed seg fault messages to logs as well as the main stdout and stderr?
<mlindner> or do i need to manually write a parser to read the return code of the program
#upstart 2014-09-23
<raphendyr> any ideas how to kill acpid from chroot?.. initctl list show stop/waiting in chroot and in host for apic (killed the host's acpid too...)
<raphendyr> term, kill and other random signals kills it, but then it respawns...
<diegows> hi
<diegows> quick question
<diegows> respawn without any argument try to start the process forever or the defaults mentioned in the man page for "respawn limit COUNT INTERVAL" apply?
<diegows> "Default COUNT is 10. Default INTERVAL is 5 seconds."
<raphendyr> thanks... that solved my problem :D "keep killing it... it will die eventually..."
<guymatz> Hello!  Long-time sys admin, first time with upstart . . .   I'm using start-stop-daemon - which seems to be the preferred method - however my app needs to be run from a specific directory and the --chdir option doesn't seem to be doing what it sounds like it's going to do, however I can't really tell what's going on since upstart/start-stop-daemon seems to swallow all output . . .  anyone know if there is there a good way to debug u
<guymatz> ntu?
#upstart 2014-09-24
<crystal77> How would I prevent a process from starting if there is less than 95% disk space? I can do that with init scripts very easily (new to upstart)
<phaidros> can I use the config filename in my config file? (that way I could have a generic config, which I just rename, eg.: unicorn-user1-4000.conf .. so I can use the username and the port in my exec line somehow?)
<phaidros> $UPSTART_JOB is what i was looking for :)
<kierank> Is upstart able to wait for a kernel module to load
<kierank> I really don't want to add a sleep 10 to "fix" that
<xnox> kierank: sure, there are udev events emited
<xnox> so you can start on udev events which should be post udev firing and processing/loading kernel modules as needed etc.
#upstart 2014-09-25
<atmosx> hello
<atmosx> trying to make upstart work with foreman, created the files, appstart shows it starts but I see nothing :-/ I'm on RPi does this matter?
#upstart 2014-09-26
<undata> hi, I've got a python program which runs as an upstart job
<undata> when I run it by hand as a certain user in the audio group, it can play sound
<undata> when run via upstart setuid to the same user it cannot play sound
<undata> would anyone know why?
<JanC> undata: I think it has to do with login sessions
<JanC> so you probably need su/sudo
<JanC> http://upstart.ubuntu.com/cookbook/#changing-user
<undata> JanC: thank you; I will try that
#upstart 2015-09-21
<duvnell>  I have a service .conf file  which has "start on lightdm"  so that it's started only after the display manager starts.   But of course if the user is running kdm, gdm, xdm, etc.. that doesn't work.  Is there an alias which means whatever-display-manager-the-user-uses or do I need to OR all the possible display manager names that I can think of?  (should start more or less at the login screen (i.e. when display manager starts).. not waiting for user to l
<JanC> you mean 'start on started lightdm', I guess
<JanC> duvnell: in Ubuntu there is a 'login-session-start' event
<JanC> see the 'upstart-events' manpage
<JanC> oh no, that fires before the DM starts
<duvnell> right
<duvnell> I haven't find anything that works well
#upstart 2015-09-22
<kants> Hey guys. I've been using Upstart with start-stop-daemon on ubuntu to keep my node scripts running. I'm setting up something on an AWS AMI which i think is based on CentOS - no start-stop-daemon. Any advice on doing this? Can I install it? Should I do this another way on this distro?
<jtheuer> I start a web server via upstart. I have to wait until it is available (http ping check for example). Should/Can I put the check in the upstart script? Is that good practise?
#upstart 2015-09-23
<jtheuer> Can I wait for my process to successfully start in my upstart script?
<jtheuer> ...and fail if it exists != 0?
<duvnell> is there an equivalent to the console-kit command line that lists what x sessions are running and information about them?
#upstart 2015-09-24
<zzsnzmn> i would like to add a command to an upstart script i'm working on. 
<zzsnzmn> basically send a SIGUSR1 by doing service foo halt
<zzsnzmn> is this possible? i couldn't really find anything in the manual that talked about this.
<JanC> I assume you mean 'stop' instead of 'halt'?
<JanC> that should work
<zzsnzmn> sort of, my use case is that i want to send a USR1 command to a sidekiq process. This signal tells the process not to take any more work and finish any open jobs. Then at a later point send a TERM signal to actually stop the process.
<JanC> you can just send the signal too...
<JanC> or use whatever command the process provides, or whatever
<zzsnzmn> yeah, just realized i can do a `service foo status` and grep out the process id and send the right signal
<zzsnzmn> wasn't sure how that would be handled.
#upstart 2015-09-25
<jtheuer> How would I execute a script BEFORE ssh starts?
<jtheuer> -> sshd
#upstart 2017-09-29
<alive876> hi, i installed upstart on ubuntu 14 with apt-get sudo apt-cache policy upstart upstart:   Installed: 1.12.1+1627+1562+201406041317~ubuntu14.04.1, but   upstart: command not found   ?  thanks
#upstart 2019-09-24
<ws2k3> anyone around?
<ws2k3> im trying to find out why a upstart service is not starting after boot. when i start it manualy it works just fine. there is also no .log file in /var/log/upstart anyone an idea on how to debug?
