all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Lars Rustand <rustand.lars@gmail.com>
To: help-guix@gnu.org
Subject: Offlineimap is not able to run as a shepherd service
Date: Thu, 07 Dec 2023 10:15:59 +0100	[thread overview]
Message-ID: <875y1al57l.fsf@yoga.mail-host-address-is-not-set> (raw)


Hello, I'm trying to run offlineimap as a shepherd service, but it fails
in a weird way. I'm able to run offlineimap just fine when I start from
the commandline, but inside the service it fails with this error:

-8<---------------cut here---------------start------------->8---
2023-12-07 10:31:13 Traceback:
2023-12-07 10:31:13   File "/gnu/store/g2231vkzbnncyj72085n1ylkh8hq16lm-offlineimap-8.0.0/lib/python3.10/site-packages/offlineimap/accounts.py", line 298, in syncrunner
2023-12-07 10:31:13     self.__sync()
2023-12-07 10:31:13   File "/gnu/store/g2231vkzbnncyj72085n1ylkh8hq16lm-offlineimap-8.0.0/lib/python3.10/site-packages/offlineimap/accounts.py", line 374, in __sync
2023-12-07 10:31:13     remoterepos.getfolders()
2023-12-07 10:31:13   File "/gnu/store/g2231vkzbnncyj72085n1ylkh8hq16lm-offlineimap-8.0.0/lib/python3.10/site-packages/offlineimap/repository/IMAP.py", line 681, in getfolders
2023-12-07 10:31:13     imapobj = self.imapserver.acquireconnection()
2023-12-07 10:31:13   File "/gnu/store/g2231vkzbnncyj72085n1ylkh8hq16lm-offlineimap-8.0.0/lib/python3.10/site-packages/offlineimap/imapserver.py", line 683, in acquireconnection
2023-12-07 10:31:13     e.args[0][:35] == 'IMAP4 protocol error: socket error:':
2023-12-07 10:31:13
-8<---------------cut here---------------end--------------->8---

I am using the exact same commandline arguments both in the shepherd
service and when running offlineimap manually, so Shepherd must be doing
something weird that causes offlineimap to fail.

Here is my service definition:

-8<---------------cut here---------------start------------->8---
(define-module (lrustand services offlineimap)
  #:use-module (gnu)
  #:use-module (gnu services)
  #:use-module (gnu packages mail)
  #:use-module (gnu services shepherd)
  #:use-module (gnu services configuration)
  #:use-module (guix gexp)
  #:use-module (guix records)
  #:use-module (ice-9 curried-definitions)
  #:use-module (gnu home services)
  ;; For the 'home-shepherd-service-type' mapping.
  #:use-module (gnu home services shepherd)
  #:export (offlineimap-configuration
            offlineimap-configuration?

            offlineimap-configuration-log-file
            offlineimap-configuration-pid-file

            offlineimap-shepherd-service
            offlineimap-service-type
            home-offlineimap-service-type))

(define-configuration/no-serialization offlineimap-configuration
  (pid-file
   (string "/var/run/offlineimap.pid")
   "Where to store the PID file.")
  (config-file
   (string "/home/lars/.config/offlineimap/config")
   "Configuration file to use.")
  (log-file
   (string "/home/lars/offlineimap.log")
   "File where ‘offlineimap’ writes its log to.")
  (extra-options
   (list-of-strings '())
   "This option provides an “escape hatch” for the user to provide
arbitrary command-line arguments to ‘offlineimap’ as a list of strings.")
  (home-service?
   (boolean for-home?)
   ""))

(define offlineimap-shepherd-service
  (match-record-lambda <offlineimap-configuration>
    (pid-file config-file log-file extra-options home-service?)
    (list (shepherd-service
           (provision '(offlineimap))
           (documentation "")
           (requirement (if home-service? '() '(user-processes)))
           (start #~(make-forkexec-constructor
                      (list (string-append #$offlineimap
                                           "/bin/offlineimap")
                             #$@extra-options
                             "-c" #$config-file
                             "-l" #$log-file)
                     #:log-file #$log-file
                     #:pid-file #$pid-file))
           (stop #~(make-kill-destructor))
           (one-shot? #f)
           (respawn? #t)))))

(define offlineimap-service-type
  (service-type
   (name 'offlineimap)
   (extensions
    (list (service-extension shepherd-root-service-type
                             offlineimap-shepherd-service)))
   (default-value (offlineimap-configuration))
   (description
    "Synchronize remote IMAP mail with local Maildir.")))

(define home-offlineimap-service-type
  (service-type
   (inherit (system->home-service-type offlineimap-service-type))
   (default-value (for-home (offlineimap-configuration)))))
-8<---------------cut here---------------end--------------->8---


             reply	other threads:[~2023-12-07  9:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-07  9:15 Lars Rustand [this message]
2023-12-08 22:08 ` Offlineimap is not able to run as a shepherd service Lars Rustand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=875y1al57l.fsf@yoga.mail-host-address-is-not-set \
    --to=rustand.lars@gmail.com \
    --cc=help-guix@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.