[kdepim-users] How to restart akonadi from cron?

ITSEF Admin itsef-admin at brightsight.com
Thu Nov 14 10:25:25 GMT 2013


Hi all,

in an attempt to devise a workaround for the akonadi cache corruption by 
server disconnect showstopper-bug 
(https://bugs.kde.org/show_bug.cgi?id=327513), I'm currently trying the 
following:

Just before the server goes down each night, I want to stop akonadi in the 
user account, then start it again after the server is back. In theory, the 
easiest way to do this is cron. It already took me some time to figure out 
that akonadictl does not just work when run from cron as there is d-bus 
involved as well. Hence, I'm doing this:

-------
akonadiserver_pid=$(pgrep -u $LOGNAME -n akonadiserver)
eval $(tr '\0' '\n' < /proc/$akonadiserver_pid/environ | grep 
'^DBUS_SESSION_BUS_ADDRESS=')
export DBUS_SESSION_BUS_ADDRESS

/usr/bin/akonadictl stop
sleep 3600
/usr/bin/akonadictl start
-------

What this does is determine the d-bus address, then set the appropriate 
variable and to the akonadi stop/start.

According to the logs, akondai *does* stop and it *does* start (i.e. in the 
morning "akonadictl status" reports it as running again). However, all mail 
accounts in KMail are flagged as broken and all imap_agents are flagged as 
"unable to start" in akonadiconsole. The akonadiserver.err file lists  bunch 
of 
"Cannot connect to agent instance with identifier 'akonadi_imap_resource_X', 
error message: 'Could not get owner of name 
'org.freedesktop.Akonadi.Resource.akonadi_imap_resource_X': no such name'"

If I now issue another "akonadictl restart" from a terminal window (i.e. not 
from cron), akonadi restarts and everything goes back to normal.

Apparently, there is something subtle missing when trying to (re-)start 
akonadi from cron - but so far, I have no idea what. Google only mentioned the 
d-bus stuff.

Hence, if anybody out there has an idea, please let me know - thanks!

Regards,

Thomas
-- 
------------------------------------------------------------------------------
	Thomas Ribbrock, IT-Team brightsight
_______________________________________________
KDE PIM users mailing list
Subscription management: https://mail.kde.org/mailman/listinfo/kdepim-users



More information about the kdepim-users mailing list