diff options
author | Andrew Tropin <andrew@trop.in> | 2022-04-12 11:30:58 +0300 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2022-04-12 23:30:09 +0200 |
commit | 8805c7eab1d375846dd648065979d8d1a062f176 (patch) | |
tree | 37bf3777096bc235d9856eb86bdbaa2152a5fa51 | |
parent | 6a69e41c1783fa2eafd06cf1844d680ed1a09f65 (diff) |
home: shepherd: Prevent launching the second instance.
Fixes <https://issues.guix.gnu.org/54545>.
* gnu/home/services/shepherd.scm (launch-shepherd-gexp): Launch shepherd
if and only if its socket file does not already exist.
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
-rw-r--r-- | gnu/home/services/shepherd.scm | 26 |
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) |