Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I was wandering if it is possible to access the DBUS session bus from within an upstart script.

The background is this:
I am running an upstart task in user mode and replaced the Upstart.conf dbus configuration file with the one from the upstart bzr repository.

Now it would like to access the gnome keyring within that tasks script using gkeyring, which needs to access the users upstart session bus. By default, I just get the Gnome keyring not available.

When I try to export DBUS_SESSION_BUS_ADDRESS=... within the upstart script, the script/initctl command just hangs, no output anywhere.

This leads me to believe that since upstart uses DBUS as well, using the session bus is problematic. Does someone have an idea to resolve this?

share|improve this question
    
There could be multiple session buses for a user, so this isn't an easy one to answer. Have you considered launching your app as part of the user session instead? –  James Henstridge Sep 15 '12 at 0:12
add comment

1 Answer

this might work for you ?...

script
    export HOME="/home/puma"
    chdir /home/puma/apps/whatever/bin
    dbus_file=$(ls $HOME/.dbus/session-bus/ -t1 | head -1)
    . "$HOME/.dbus/session-bus/$dbus_file"
    export DBUS_SESSION_BUS_ADDRESS
    exec su -s /bin/sh -c 'export DBUS_SESSION_BUS_ADDRESS=$DBUS_SESSION_BUS_ADDRESS;exec /home/puma/apps/whatever/bin/appname' puma 
end script

hope it helps ?

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.