Accessing dbus from cron job

Marco netuse at
Fri Dec 14 03:00:53 PST 2012


I already posted my issue on the gnome-keyring mailing list, but it
was suggested that it is more a general dbus topic. Here's my issue;

I'd like an application run from a user crontab to access a password
stored in the gnome-keyring (which relies on dbus). Apparently jobs
run in the cron job environment do not have access to the dbus
session data.

My current workaround is the following script which I run after

touch $HOME/.dbus/Xdbus
chmod 600 $HOME/.dbus/Xdbus
env | grep DBUS_SESSION_BUS_ADDRESS > $HOME/.dbus/Xdbus
echo 'export DBUS_SESSION_BUS_ADDRESS' >> $HOME/.dbus/Xdbus

The resulting file is sourced by the script than runs as a cron job.
It is working, but feels clumsy.

Is there a proper or an easier way to access the dbus environment
needed for gnome-keyring to be run from cron?

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: Digital signature
URL: <>

More information about the dbus mailing list