[16:14] <tstone> hi, is there a way to get dbus signals as events in the upstart daemon?
[16:15] <Keybuk> fairly trivially with some python
[16:16] <tstone> this is for a embedded device and i don't have any python on that :-(
[16:17] <tstone> i have seen there is s.t. like a upstart-udev-bridge under lucid, would this be a good template to get this 
[16:17] <Keybuk> C?
[16:17] <Keybuk> yeah, exactly
[16:17] <tstone> functionality into dbus
[16:17] <Keybuk> you connect to the bus, add a match on the signal, and when you get the signal, you make a method call to Upstart to emit the event
[16:20] <tstone> so it might also be possible to use the upstart dbus interface to emit a new event?
[16:20] <Keybuk> it is
[16:20] <Keybuk> com.ubuntu.Upstart0_6.EmitEvent
[16:21] <Keybuk> http://upstart.ubuntu.com/wiki/DBusInterface
[16:28] <tstone> nice, i think i will use the dbus interface, thanks
[16:28] <tstone> i have btw. integrated upstart into ptxdist.org which is a build system for embedded systems.
[16:29] <tstone> i am planning to get the patches upstream.
[16:46] <Keybuk> cool
[16:55] <tstone> good bye
[17:39] <Linicks> I would like to start the unicorn web server for my rails environment at stat startup as a specific user.  Can you point me in the right direction?
[17:39] <Linicks> I have found docs for creating startup commands with exec, but nothing that specifies the user 
[17:41] <ion> For now, use su.
[17:41] <Linicks> ok, will give that a try. thx
[18:23] <Linicks> created a configuration file ( http://pastie.org/980315) in /etc/init.  But I'm not sure how to test it.  I tried -- sudo start priver -- but get --- start: Unknown job: priver
[18:24] <Linicks> per the docs here : http://upstart.ubuntu.com/getting-started.html
[18:24] <Linicks> I'm sure I'm missing something simple.
[18:28] <Linicks> ion: any ideas?
[18:33] <ion> 0) Unicorn is a service, not a task. 1) Running su in a pre-start script has no effect on the exec. (Btw, you can use ; instead of && since the script is run with set -e.) 2) The specific problem that caused Upstart not to recognize the job at all is a syntax error (as you’ll find in your syslog), namely that ‘pre-start blah’ is invalid syntax; you’d use ‘pre-start exec blah’ or a pre-start script.
[18:34] <ion> exec su -c 'set -e; ...' username, or something like that
[18:36] <Linicks> ion: Thanks! I will work on that and see if I get any further :)
[18:38] <ion> exec su -c 'set -e; cd PATH; exec unicorn_rails blahblah' username, where the parameters for unicorn_rails make it not daemonize/fork.
[18:39] <ion> Also, you probably don’t want it to start on startup, but instead when there’s a writeable filesystem etc.
[18:39] <ion> ‘start on filesystem’ may or may not suffice.
[19:24] <Linicks> ion: Making some headway!  But when I run the job --> start priverpriver  I get --> start/running, process 4954, but the process isn't in the process list.  I've tested this --> set -e; cd /home/prweb/priver_002/; unicorn_rails -p 59504 directly on the command line and it works.
[19:25] <ion> unicorn_rails probably forks then. You’ll need to make it not fork/daemonize. :-)
[19:27] <Linicks> I think by design unicorn creates a fork(s).  Would it be better to use script instead of exec, if thats the case?
[19:28] <ion> That’s not relevant.
[19:29] <ion> Judging from http://unicorn.bogomips.org/unicorn_rails_1.html, it shouldn’t daemonize without -D. Dunno why it does, then.
[19:30] <Linicks> Ok, so that I understand this a little better, why can't it start as a daemon?
[19:30] <ion> What does status priverpriver say?
[19:31] <Linicks> status: Unable to connect to system bus: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory
[19:31] <ion> Your dbus service seems to be dead. Try sudo status priverpriver for now.
[19:33] <Linicks> sudo status priver --> priver stop/waiting
[19:34] <Linicks> Just as an FYI, I'm on a new Ubuntu 10.04 server install with all current updates.
[19:34] <ion> If you run unicorn_rails -p 59504 from the command line, does it daemonize or stay in the foreground?
[19:37] <Linicks> it stays in the foreground.
[19:40] <Linicks> Here is the example output from my test server --> http://pastie.org/980495
[19:46] <ion> Ok, so daemonizing is not the problem.
[19:46] <ion> Please share your current job definition.
[19:48] <Linicks> Here is my current def --> http://pastie.org/980518
[19:51] <ion> (You may want to change ‘...; unicorn_rails ...’ to ‘...; exec unicorn_rails ...’, but that’s not the problem here, it just doesn’t leave an extra shell process running that way.)
[19:52] <ion> script
[19:52] <ion>   exec >/home/prweb/priver_002/job.log 2>&1
[19:53] <ion>   set -x
[19:53] <ion>   exec su -c 'set -ex; cd /home/prweb/priver_002/; exec unicorn_rails -p 59504 --host 192.168.1.15' prweb
[19:53] <ion> end script
[19:53] <ion> Try that. Anything interesting in job.log?
[19:57] <Linicks> This was in the log -- bash: line 0: exec: unicorn_rails: not found 
[19:57] <Linicks> It doesn't seem to be getting the users environment ?
[19:57] <ion> Ok, try /path/to/unicorn_rails
[20:02] <Linicks> I tried it with the full path to unicorn_rails, and I'm getting the same results..
[20:03] <Linicks> Of course everything works correctly when I execute the command directly from the shell.
[20:04] <ion> It says “exec: /.../unicorn_rails: not found”?
[20:09] <Linicks> Getting this in the log --> /home/prweb/.rvm/rubies/ruby-1.9.1-p378/lib/ruby/site_ruby/1.9.1/rubygems.rb:779:in `report_activate_error': Could not find RubyGem unicorn (>= 0) (Gem::LoadError)
[20:12] <ion> Ok, you’ll need to insert a command to load the rvm environment before executing unicorn_rails.
[20:13] <ion> exec su -c 'set -e; . /home/prweb/.rvm/scripts/rvm; exec ...' prweb
[20:13] <ion> it seems
[20:19] <Linicks> Excellent!!! That finally did the trick.. Couldn't have done this without you help.  Many, Many Thanks!!!   
[22:27] <Imperion> um
[22:28] <Imperion> I'm trying to boot up Linux on a USB stick with Upstart as the init daemon
[22:28] <Imperion> but for some reason, it's not doing any jobs nor listening for ctrl-alt-del (it doesn't trigger a reboot)
[22:29] <Imperion> it seems like it dies right after startup
[22:29] <Imperion> any ideas?