You are not logged in.

#1 2014-06-13 12:46:47

ziv667
Member
Registered: 2012-05-24
Posts: 14

[solved] Offlineimap, Gnome-Keyring and Cronjob

Hi there,

i am trying to get my mail with offlineimap, while the password are store in gnome-keyring.
which is working.

but since i want to check for new mails regularly i tried using cron but it isnt quiet working, cause cron is not the desired env variables (i guess)
i tried using, this script which i start right after login.

#!/bin/bash
# Export the dbus session address on startup so it can be used by cron
touch $HOME/.Xdbus
chmod 600 $HOME/.Xdbus
env | grep DBUS_SESSION_BUS_ADDRESS > $HOME/.Xdbus
echo 'export DBUS_SESSION_BUS_ADDRESS' >> $HOME/.Xdbus

with this result:
cat ~/.Xdbus:

DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-LMDcCxHfcZ,guid=7d62235b12cfd93474d47bb0539a55c4
export DBUS_SESSION_BUS_ADDRESS

but this does not seems to be working. the logfile gives me something like this:

Please enter password for encrypted keyring: /usr/lib/python2.7/getpass.py:83: GetPassWarning: Can not control echo on the terminal.
  passwd = fallback_getpass(prompt, stream)
Warning: Password input may be echoed.
Please enter password for encrypted keyring: *** Processing account google
Establishing connection to imap.gmail.com:993
*** Processing account main
ERROR: Could not lock account main. Is another instance using this account?
*** Finished account 'main' in 0:00
Warning: Password input may be echoed.
Please enter password for encrypted keyring: ERROR: While attempting to sync account 'google'
  
*** Finished account 'google' in 0:00 

This is a part of my .offlineimaprc, i removed the other mail accounts, nothing special in here:

[general]
accounts =  google
maxsyncaccounts = 1 
ui = quiet 
pythonfile = ~/bin/offlineimap.py

[Account google]
localrepository = google-local
remoterepository = google-remote
status_backend = sqlite
autorefresh = 3
quick = 10

[Repository google-local]
type = Maildir
localfolders = ~/.mail/google

[Repository google-remote]
type = IMAP
remotehost = imap.gmail.com
remoteuser = "username"
ssl = yes
sslcacertfile = /etc/ssl/certs/ca-certificates.crt
remoteport = 993
folderfilter = lambda folder: not re.search('(|mailbox)', folder)
remotepasseval = keyring.get_password('gmail', 'personal')

.
so my question is: is there any prefered solution, since the ~/.Xdbus approach does not seem to work.
the wiki does not cover this, and most of the solutions i found by googling use the above approach.
if anyone got an idea or can point out my mistake, that would be nice

thank you

Last edited by ziv667 (2014-06-27 06:16:34)

Offline

#2 2014-06-27 06:16:19

ziv667
Member
Registered: 2012-05-24
Posts: 14

Re: [solved] Offlineimap, Gnome-Keyring and Cronjob

Ok, i fixed it myself by creating the socket file.
Apparently the dbus socket is a virtual one, but creating this file simply solved my problem.

So i put it in my start up scripts.

Last edited by ziv667 (2014-06-27 06:17:21)

Offline

Board footer

Powered by FluxBB