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
brilliant! thanks a million
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
{ 1 } Trackback
[...] 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 [...]
Post a Comment