summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2015-05-06 15:30:06 -0400
committerDavid Thompson <dthompson2@worcester.edu>2015-05-06 15:38:28 -0400
commit1e579064aed9f32061e5edbe1c693cab21f0ce75 (patch)
tree64f5afba53101268f65266c08d49df324558add2
parent001da5b13d47c484c7b4e73e1dc9ffbebb2ca8cb (diff)
dmd: Improve offlineimap service.
This change, coupled with not using the "autorefresh" mode, means that OfflineIMAP doesn't eat all of my RAM anymore!
-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"))