summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dotfiles/dmd.d/init.scm23
1 files changed, 22 insertions, 1 deletions
diff --git a/dotfiles/dmd.d/init.scm b/dotfiles/dmd.d/init.scm
index ff91b05..420c7cf 100644
--- a/dotfiles/dmd.d/init.scm
+++ b/dotfiles/dmd.d/init.scm
@@ -1,3 +1,13 @@
+(use-modules (ice-9 match))
+
+(define-syntax-rule (forever body ...)
+ (while #t body ...))
+
+(define-syntax-rule (with-fork body ...)
+ (match (primitive-fork)
+ (0 (begin body ...))
+ (pid pid)))
+
(define (simple-service program)
(make <service>
#:provides (list (string->symbol program))
@@ -6,7 +16,18 @@
#:stop (make-kill-destructor)))
(register-services
- (simple-service "offlineimap")
+ (make <service>
+ #:provides '(offlineimap)
+ #:requires '()
+ #:start (lambda args
+ (with-fork
+ ;; OfflineIMAP's "autorefresh" mode consistently
+ ;; consumes all of the RAM on my machine, so let's just
+ ;; run it in a loop instead.
+ (forever
+ (system* "offlineimap")
+ (sleep 20))))
+ #:stop (make-kill-destructor))
(simple-service "mpd")
(simple-service "mpdscribble"))