cron/dbus problem?
Stephen Gallagher
sgallagh at redhat.com
Fri Sep 18 13:05:10 UTC 2009
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 09/17/2009 07:04 PM, S Knox wrote:
> Dear list,
> Back in 2006, someone wrote the following:
> -------------------------------------------------------------------------------------
>
> * /From/: Dennis Jacobfeuerborn <d jacobfeuerborn conversis de>
> * /To/: Development discussions related to Fedora Core
> <fedora-devel-list redhat com>
> * /Subject/: cron/dbus problem?
> * /Date/: Mon, 13 Feb 2006 15:13:25 +0100
>
> Given the (puzzling) absence of an alarm/reminder applet for the gnome
> panel I tried (ab)using Tomboy for this purpose but hit a problem
> involving Cron and DBus. When I call "tomboy --open-note Alarm" the
> respective notes pops up but when I put the same command in the crontab
> I get this: Unhandled Exception: DBus.DBusException: Unable to determine
> the address of the message bus
>
> in <0x0009f> DBus.Bus:GetBus (BusType busType)
> in <0x00009> DBus.Bus:GetSessionBus ()
> in <0x00022> Tomboy.TomboyCommandLine:Execute ()
> in <0x00061> Tomboy.Tomboy:Main (System.String[] args)
>
> Does anyone have an idea why the session bus seems to be available from
> a regular shell but not from cron?
>
> Regards,
> Dennis
>
> --------------------------------------------------------------------------------------
>
> Don't know whether this is of use to anyone faced with the same problem, or to help with wider development, but I solved the problem by using the
> following
> line in a crontab:
> * * * * * export DBUS_SESSION_BUS_ADDRESS=`cat "/proc/$(expr substr $(ps -C tomboy -o pid=) 1 5)/environ" | tr '\0' '\n' | grep DBUS | cut -d '=' -f2-`; tomboy (options)
>
> Sorry if this has all been sorted out by now, but didn't know where to post.
>
> Steve
>
>
> Send instant messages to your online friends http://uk.messenger.yahoo.com
>
The session bus is, by definition, local to a particular session. When
you run a service in cron, it is running in a new session (because it
has been launched by the cron daemon) and cannot share the session bus
with your desktop. If you need it to share a bus BETWEEN sessions,
that's what the system bus is for.
- --
Stephen Gallagher
RHCE 804006346421761
Looking to carve out IT costs?
www.redhat.com/carveoutcosts/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/
iEYEARECAAYFAkqzhYIACgkQeiVVYja6o6NnrQCffiq5+X+xpORFUlgMZwFRRg2e
tf8An05tRWURnzogS/gnQU4OWL2iv6in
=3JnG
-----END PGP SIGNATURE-----
More information about the devel
mailing list