summary refs log tree commit diff
path: root/gnu/home/services
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/home/services')
-rw-r--r--gnu/home/services/shepherd.scm26
1 files changed, 15 insertions, 11 deletions
diff --git a/gnu/home/services/shepherd.scm b/gnu/home/services/shepherd.scm
index 012585fea4..df6bbb30e6 100644
--- a/gnu/home/services/shepherd.scm
+++ b/gnu/home/services/shepherd.scm
@@ -93,17 +93,21 @@ as shepherd package."
          (services (home-shepherd-configuration-services config)))
     (if (home-shepherd-configuration-auto-start? config)
         (with-imported-modules '((guix build utils))
-          #~(let ((log-dir (or (getenv "XDG_LOG_HOME")
-                               (format #f "~a/.local/var/log" (getenv "HOME")))))
-              ((@ (guix build utils) mkdir-p) log-dir)
-              (system*
-               #$(file-append shepherd "/bin/shepherd")
-               "--logfile"
-               (string-append
-                log-dir
-                "/shepherd.log")
-               "--config"
-               #$(home-shepherd-configuration-file services shepherd))))
+          #~(unless (file-exists?
+                     (string-append
+                      (or (getenv "XDG_RUNTIME_DIR")
+                          (format #f "/run/user/~a" (getuid)))
+                      "/shepherd/socket"))
+              (let ((log-dir (or (getenv "XDG_LOG_HOME")
+                                 (format #f "~a/.local/var/log"
+                                         (getenv "HOME")))))
+                ((@ (guix build utils) mkdir-p) log-dir)
+                (system*
+                 #$(file-append shepherd "/bin/shepherd")
+                 "--logfile"
+                 (string-append log-dir "/shepherd.log")
+                 "--config"
+                 #$(home-shepherd-configuration-file services shepherd)))))
         #~"")))
 
 (define (reload-configuration-gexp config)