星期五, 2月 17, 2012

[tips] access gnome-keyring in cron

It seems program execute in your crontab doesn't have the luxury to use the gnome-keyring daemon to get the permission it should had. In order to let your program access gnome-keyring, you need to reuse a environment variable in your desktop session called DBUS_SESSION_BUS_ADDRESS in your cron environment also.The quickest way to do it is to add these line:


. ~/.dbus/session-bus/*-0
export DBUS_SESSION_BUS_ADDRESS


in your cron script (it assume you logged in under X display 0)