cron/dbus problem?

Bastien Nocera bnocera at redhat.com
Fri Sep 18 13:18:38 UTC 2009


On Fri, 2009-09-18 at 09:05 -0400, Stephen Gallagher wrote:
> -----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.

Or have a cron instance (or similar) running within the session. I'm
pretty sure there's already GUI-like crons available for GNOME and other
desktops.

Something like that:
http://www.gnomefiles.org/app.php/DoThisNow

Cheers




More information about the fedora-devel-list mailing list