Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
G
Guix
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ogs
inf
Guix
Commits
b93d7dae
Unverified
Commit
b93d7dae
authored
4 years ago
by
Ludovic Courtès
Browse files
Options
Downloads
Patches
Plain Diff
doc: Add 'shepherd-service' example.
* doc/guix.texi (Shepherd Services): Add example.
parent
43937666
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
doc/guix.texi
+32
-0
32 additions, 0 deletions
doc/guix.texi
with
32 additions
and
0 deletions
doc/guix.texi
+
32
−
0
View file @
b93d7dae
...
...
@@ -34060,6 +34060,38 @@ This is the list of modules that must be in scope when @code{start} and
@end table
@end deftp
The example below defines a Shepherd service that spawns
@command{syslogd}, the system logger from the GNU Networking Utilities
(@pxref{syslogd invocation, @command{syslogd},, inetutils, GNU
Inetutils}):
@example
(let ((config (plain-file "syslogd.conf" "@dots{}")))
(shepherd-service
(documentation "Run the syslog daemon (syslogd).")
(provision '(syslogd))
(requirement '(user-processes))
(start #~(make-forkexec-constructor
(list #$(file-append inetutils "/libexec/syslogd")
"--rcfile" #$config)
#:pid-file "/var/run/syslog.pid"))
(stop #~(make-kill-destructor))))
@end example
Key elements in this example are the @code{start} and @code{stop}
fields: they are @dfn{staged} code snippets that use the
@code{make-forkexec-constructor} procedure provided by the Shepherd and
its dual, @code{make-kill-destructor} (@pxref{Service De- and
Constructors,,, shepherd, The GNU Shepherd Manual}). The @code{start}
field will have @command{shepherd} spawn @command{syslogd} with the
given option; note that we pass @code{config} after @option{--rcfile},
which is a configuration file declared above (contents of this file are
omitted). Likewise, the @code{stop} field tells how this service is to
be stopped; in this case, it is stopped by making the @code{kill} system
call on its PID@. Code staging is achieved using G-expressions:
@code{#~} stages code, while @code{#$} ``escapes'' back to host code
(@pxref{G-Expressions}).
@deftp {Data Type} shepherd-action
This is the data type that defines additional actions implemented by a
Shepherd service (see above).
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment