What is the XDG_SESSION_COOKIE environment variable?

I recently fought crontab because in Intrepid gconftool uses the dbus backend, which means that when using crontab it does not work.

To do this, I had to export the appropriate environment variables when I log in to find the dbus session address when cron starts.

Out of curiosity, I wondered in what environment cron could see, and all I have is HOME , LOGNAME , PATH , SHELL , CWD and this new one for me, XDG_SESSION_COOKIE . It looks curious, and a few googlings throw a lot of errors or other requests related to it, but nothing tells me what it does.

My instinct is that this variable can be used to find all the things that I had to export to the file that I am the source before starting the cron job.

So my questions are: a) can I? b) if so, how? and c) what (otherwise) does it do?

Thank you all

+6
linux bash cron
source share
1 answer

It is very interesting. I found out that the dispatcher displays a cookie. This can be used to register processes belonging to a “session” that are controlled by a daemon called ConsoleKit . That is, to support fast user switching. My KDE4.2.1 system apparently also supports it.

Read this post on the Fedora wiki.

So, this environment variable is similar to DBUS_SESSION_BUS_ADDRESS to provide access to some entity (in the case of XDG_SESSION_COOKIE , the XDG_SESSION_COOKIE session is managed by ConsoleKit). For example, having this environment variable, you can ask the manager for the current session:

 $ dbus-send --print-reply --system --type=method_call \ --dest=org.freedesktop.ConsoleKit \ /org/freedesktop/ConsoleKit/Manager \ org.freedesktop.ConsoleKit.Manager.GetCurrentSession method return sender=:1.1 -> dest=:1.34 reply_serial=2 object path "/org/freedesktop/ConsoleKit/Session1" $ 

The manager also maintains a request for the session, some process belongs to

 $ [...].Manager.GetSessionForUnixProcess uint32:4494 method return sender=:1.1 -> dest=:1.42 reply_serial=2 object path "/org/freedesktop/ConsoleKit/Session1" 

However, it does not contain or does not contain any variables associated with some cron job. However, the dbus-launch documentation says libdbus will automatically find the correct DBUS bus address. For example, files are stored in /home/js/.dbus/session-bus , which contain the correct current dbus session addresses.

+6
source share

All Articles