/srv/irclogs.ubuntu.com/2010/05/27/#upstart.txt

tstonehi, is there a way to get dbus signals as events in the upstart daemon?16:14
Keybukfairly trivially with some python16:15
tstonethis is for a embedded device and i don't have any python on that :-(16:16
tstonei have seen there is s.t. like a upstart-udev-bridge under lucid, would this be a good template to get this 16:17
KeybukC?16:17
Keybukyeah, exactly16:17
tstonefunctionality into dbus16:17
Keybukyou 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 event16:17
tstoneso it might also be possible to use the upstart dbus interface to emit a new event?16:20
Keybukit is16:20
Keybukcom.ubuntu.Upstart0_6.EmitEvent16:20
Keybukhttp://upstart.ubuntu.com/wiki/DBusInterface16:21
tstonenice, i think i will use the dbus interface, thanks16:28
tstonei have btw. integrated upstart into ptxdist.org which is a build system for embedded systems.16:28
tstonei am planning to get the patches upstream.16:29
Keybukcool16:46
tstonegood bye16:55
LinicksI 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
LinicksI have found docs for creating startup commands with exec, but nothing that specifies the user 17:39
ionFor now, use su.17:41
Linicksok, will give that a try. thx17:41
Linickscreated 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: priver18:23
Linicksper the docs here : http://upstart.ubuntu.com/getting-started.html18:24
LinicksI'm sure I'm missing something simple.18:24
Linicksion: any ideas?18:28
ion0) 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:33
ionexec su -c 'set -e; ...' username, or something like that18:34
Linicksion: Thanks! I will work on that and see if I get any further :)18:36
ionexec su -c 'set -e; cd PATH; exec unicorn_rails blahblah' username, where the parameters for unicorn_rails make it not daemonize/fork.18:38
ionAlso, 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.18:39
Linicksion: 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:24
ionunicorn_rails probably forks then. You’ll need to make it not fork/daemonize. :-)19:25
LinicksI think by design unicorn creates a fork(s).  Would it be better to use script instead of exec, if thats the case?19:27
ionThat’s not relevant.19:28
ionJudging from http://unicorn.bogomips.org/unicorn_rails_1.html, it shouldn’t daemonize without -D. Dunno why it does, then.19:29
LinicksOk, so that I understand this a little better, why can't it start as a daemon?19:30
ionWhat does status priverpriver say?19:30
Linicksstatus: Unable to connect to system bus: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory19:31
ionYour dbus service seems to be dead. Try sudo status priverpriver for now.19:31
Linickssudo status priver --> priver stop/waiting19:33
LinicksJust as an FYI, I'm on a new Ubuntu 10.04 server install with all current updates.19:34
ionIf you run unicorn_rails -p 59504 from the command line, does it daemonize or stay in the foreground?19:34
Linicksit stays in the foreground.19:37
LinicksHere is the example output from my test server --> http://pastie.org/98049519:40
ionOk, so daemonizing is not the problem.19:46
ionPlease share your current job definition.19:46
LinicksHere is my current def --> http://pastie.org/98051819:48
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:51
ionscript19:52
ion  exec >/home/prweb/priver_002/job.log 2>&119:52
ion  set -x19:53
ion  exec su -c 'set -ex; cd /home/prweb/priver_002/; exec unicorn_rails -p 59504 --host 192.168.1.15' prweb19:53
ionend script19:53
ionTry that. Anything interesting in job.log?19:53
LinicksThis was in the log -- bash: line 0: exec: unicorn_rails: not found 19:57
LinicksIt doesn't seem to be getting the users environment ?19:57
ionOk, try /path/to/unicorn_rails19:57
LinicksI tried it with the full path to unicorn_rails, and I'm getting the same results..20:02
LinicksOf course everything works correctly when I execute the command directly from the shell.20:03
ionIt says “exec: /.../unicorn_rails: not found”?20:04
LinicksGetting 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:09
ionOk, you’ll need to insert a command to load the rvm environment before executing unicorn_rails.20:12
ionexec su -c 'set -e; . /home/prweb/.rvm/scripts/rvm; exec ...' prweb20:13
ionit seems20:13
LinicksExcellent!!! That finally did the trick.. Couldn't have done this without you help.  Many, Many Thanks!!!   20:19
Imperionum22:27
ImperionI'm trying to boot up Linux on a USB stick with Upstart as the init daemon22:28
Imperionbut for some reason, it's not doing any jobs nor listening for ctrl-alt-del (it doesn't trigger a reboot)22:28
Imperionit seems like it dies right after startup22:29
Imperionany ideas?22:29

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