Skip to content

Running SyncEvolution as cron Job

It used to be fairly easy to run SyncEvolution as a cron job. Starting with GNOME 2.24 (as included in Ubuntu 8.10 Intrepid) it became a bit more complicated. The automatic initialization of D-Bus (required for access to gconf and thus the list of available Evolution databases) now depends on an X session, which is not available in cron.

The result is the following error:

GConf Error: Failed to contact configuration server; some possible causes are that you need to enable TCP/IP networking for ORBit, or you have stale NFS locks due to a system crash. See http://www.gnome.org/projects/gconf/ for information. (Details -  1: Not running within active session)

A solution for Python is discussed on Stack Overflow. Here’s how the problem can be solved for SyncEvolution. In your crontab, use:

54 9 * * * env `dbus-launch` sh -c 'trap "kill $DBUS_SESSION_BUS_PID" EXIT; syncevolution'

This starts a D-Bus session (dbus-launch), runs syncevolution, then kills the D-Bus daemon (via the process ID set by dbus-launch) once syncevolution completes. It does that every day at 9:54. If you change that, then don’t run it too often, because that can consume a lot of resources on the server.

{ 2 } Comments

  1. potatochip | August 20, 2009 at 11:59 pm | Permalink

    brilliant! thanks a million :)

  2. edin | September 16, 2009 at 8:00 pm | Permalink

    I need help
    I am running a sql file which has to insert around 4033 rows in a specific table. Manually it works fine. But when I use crontab it just insert 71 rows.
    The log says after the row 71
    2009-09-16 09:57:01 AST LOG: could not send data to client: Broken pipe
    2009-09-16 09:57:01 AST LOG: unexpected EOF on client connection

    Any suggestion is really appreciated

{ 2 } Trackbacks

  1. [...] we want.  I used alarmd (available in extras-devel) to do this.  I used a tip from here: http://www.estamos.de/blog/2009/05/08/running-syncevolution-as-cron-job/ to setup the alarm command.  To save you the jump [...]

  2. the watch hut | October 18, 2014 at 5:43 am | Permalink

    the watch hut…

    SyncEvolution – The Missing Link : Running SyncEvolution as cron Job…

Post a Comment

Your email is never published nor shared. Required fields are marked *