summary refs log tree commit diff
path: root/doc
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2022-11-11 18:54:25 +0100
committerLudovic Courtès <ludo@gnu.org>2022-11-18 15:44:39 +0100
commitebc7de6a1efb702fd0364128cbde19697966c4f4 (patch)
treecd959c5cb0375fd6ba1515270e344c67ec48fd40 /doc
parentff00cdcd92d92d5b8ab9a97e66e0afada4405be7 (diff)
downloadguix-ebc7de6a1efb702fd0364128cbde19697966c4f4.tar.gz
services: shepherd: Define 'shepherd-configuration-action' helper.
* gnu/services/shepherd.scm (shepherd-configuration-action): New
* doc/guix.texi (Shepherd Services): Document it.
Diffstat (limited to 'doc')
-rw-r--r--doc/guix.texi33
1 files changed, 33 insertions, 0 deletions
diff --git a/doc/guix.texi b/doc/guix.texi
index 2d4f7d960e..9dddaf4f2f 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -39999,6 +39999,39 @@ This, as you can see, is a fairly sophisticated way to say hello.
 info on actions.
 @end deftp
 
+@cindex configuration file, of Shepherd services
+@deffn {Scheme Procedure} shepherd-configuration-action
+Return a @code{configuration} action to display @var{file}, which should
+be the name of the service's configuration file.
+
+It can be useful to equip services with that action.  For example, the
+service for the Tor anonymous router (@pxref{Networking Services,
+@code{tor-service-type}}) is defined roughly like this:
+
+@lisp
+(let ((torrc (plain-file "torrc" @dots{})))
+  (shepherd-service
+    (provision '(tor))
+    (requirement '(user-processes loopback syslogd))
+
+    (start #~(make-forkexec-constructor
+              (list #$(file-append tor "/bin/tor") "-f" #$torrc)
+              #:user "tor" #:group "tor"))
+    (stop #~(make-kill-destructor))
+    (actions (list (shepherd-configuration-action torrc)))
+    (documentation "Run the Tor anonymous network overlay.")))
+@end lisp
+
+Thanks to this action, administrators can inspect the configuration file
+passed to @command{tor} with this shell command:
+
+@example
+cat $(herd configuration tor)
+@end example
+
+This can come in as a handy debugging tool!
+@end deffn
+
 @defvr {Scheme Variable} shepherd-root-service-type
 The service type for the Shepherd ``root service''---i.e., PID@tie{}1.