6

Intrepid では gconftool が dbus バックエンドを使用しているため、最近 crontab と戦っています。これは、crontab から使用すると機能しないことを意味します。

それを機能させるには、ログイン時に関連する環境変数をエクスポートして、cron が実行されるときに dbus セッション アドレスを見つける必要がありました。

好奇心から、cronがどのような環境を見ることができるのだろうと思ったのですがHOME、私が持っているLOGNAMEのはPATH、、、、そしてこの新しいものだけでSHELLあることがわかりました。これは奇妙に見え、いくつかのグーグルがそれに関連する多くのバグやその他の機能要求を投げかけましたが、それが何をするのかを私に伝えるものは何もありません.CWDXDG_SESSION_COOKIE

私の本能は、この変数を使用して、cron ジョブを実行する前にソース ファイルにエクスポートしなければならなかったすべてのものを見つけることができるということです。

したがって、私の質問は次のとおりです。b) もしそうなら、どのように?c) それは (他に) 何をしますか?

皆さんありがとう

4

1 に答える 1

6

This is very interesting. I found out it is the display manager setting a cookie. That one can be used to register processes to belong to a "session" which are managed by a daemon called ConsoleKit. That is to support fast user switching. My KDE4.2.1 system apparently supports it too.

Read this fedora wiki entry.

So this environment variable is like DBUS_SESSION_BUS_ADDRESS to give access to some entity (in the case of XDG_SESSION_COOKIE a login-session managed by ConsoleKit). For example having that environment variable in place, you can ask the manager for your 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 supports querying 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 list or somehow contain variables that is related to some cron job. However, documentation of dbus-launch says that libdbus will automatically find the right DBUS bus address. For example, files are stored in /home/js/.dbus/session-bus that contain the correct current dbus session addresses.

于 2009-03-10T22:43:35.620 に答える