Ludovic Courtès writes: Hello, > "Jan (janneke) Nieuwenhuizen" skribis: > >> * modules/shepherd/support.scm: Export %user-cache-dir, %user-config-dir, >> %user-runtime-dir. >> * doc/shepherd.texi (User Service examples): Use them in new subsection with >> example. >> >> Co-authored-by: Efraim Flashner > > Good idea! > >> +@menu >> +* User Service examples:: >> +@end menu >> + >> +@node User Service examples >> +@subsection User Service examples > > The subsection looks lonely. :-) How about making it a section, at the > same level as “Service Examples”? Sure. > Also, since “user services” are no different than “non-user” services, > perhaps the focus should be on using the Shepherd as an unprivileged > user. Thus, I’d suggest calling the section “Managing User Services”, > or “Running the Shepherd as a User”, which do not imply that “user > services” are a new concept. > > WDYT? Yes, nice. I changed the opening to The Shepherd can be used to manage services for an unprivileged user. First, you may want to ensure it is up and running every time you log in. One way to accomplish that is by adding the following lines to @file{~/.bash_profile} (@pxref{Bash Startup Files,,, bash, The GNU Bash Reference Manual}): >> +For starters, use a toplevel @code{$XDG_CONFIG_HOME/shepherd/init.scm} >> +that looks like this: > > Maybe: “… we suggest the following top-level > @file{$XDG_CONFIG_HOME/shepherd/init.scm} file, which will automatically > load individual service definitions from > @file{~/.config/shepherd/init.d}:” Nice. >> +Then, individual user services can be put in >> +@code{$XDG_CONFIG_HOME/shepherd/init.d/}, e.g., for ssh-agent > > @command{ssh-agent} and period. :-) >> +@lisp [..] >> + #:start (let ((socket-dir (string-append %user-runtime-dir "/ssh-agent"))) >> + (unless (file-exists? socket-dir) >> + (mkdir-p socket-dir) >> + (chmod socket-dir #o700)) >> + (make-forkexec-constructor >> + `("ssh-agent" "-D" "-a" ,(string-append socket-dir "/socket")) >> + #:log-file (string-append %user-cache-dir "/ssh-agent.log"))) > > This is misleading because the code to create the socket directory runs > from the top-level, i.e., when shepherd starts. Oops; that's probably $HOME for me, because it worked... > I’d write: > > #:start (lambda () > ;; make socket dir > (fork+exec-command … #:log-file …)) Great; changed that too. > (BTW, I use ‘gnupg-agent’, which I think is pretty nice because it’s > integrated with pinentry and all. Interesting...makes me wonder: maybe we could ship init.scm together with a couple of popular user service descriptions like ssh-agent.scm, znc.scm, ...gpg-agent.scm (?) in an examples directory? That would make it even easier for people to migrate away from the old > I run it as: > eval `gpg-agent --daemon --enable-ssh-support` > > … from ~/.xsession.) It would have helped me to move away from my `eval ssh-agent` thingy ;-) New version attached (included 0001 patch for completeness but which can probably be merged into / obsoleted by #43920). Greetings, Janneke