help-guix
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Offlineimap is not able to run as a shepherd service


From: Lars Rustand
Subject: Offlineimap is not able to run as a shepherd service
Date: Thu, 07 Dec 2023 10:15:59 +0100
User-agent: mu4e 1.10.8; emacs 30.0.50

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 via email to

[Prev in Thread] Current Thread [Next in Thread]