1nbdkit-service(1)                   NBDKIT                   nbdkit-service(1)
2
3
4

NAME

6       nbdkit-service - running nbdkit as a service, and systemd socket
7       activation
8

DESCRIPTION

10       Most people start nbdkit from the command line or run it from another
11       program (see nbdkit-captive(1).  It is also possible to run nbdkit as a
12       standalone service, which is what this page describes.
13

SOCKET ACTIVATION

15       nbdkit supports socket activation (sometimes called systemd socket
16       activation).  This is a simple protocol where instead of nbdkit itself
17       opening the listening socket(s), the parent process (typically systemd)
18       passes in pre-opened file descriptors.  Socket activation lets you
19       serve infrequent NBD requests using a superserver without needing
20       nbdkit to be running the whole time.
21
22       Socket activation is triggered when both the "LISTEN_FDS" and
23       "LISTEN_PID" environment variables are set.  In this mode using -i, -p,
24       --run, -s or -U flags on the command line is illegal and will cause an
25       error.  Also in this mode nbdkit does not fork into the background (ie.
26       -f is implied).
27
28   Using socket activation with systemd
29       To use nbdkit with socket activation from systemd, create a unit file
30       ending in ".socket" (eg. /etc/systemd/system/nbdkit.socket) containing:
31
32        [Unit]
33        Description=NBDKit Network Block Device server
34
35        [Socket]
36        ListenStream=10809
37
38        [Install]
39        WantedBy=sockets.target
40
41       There are various formats for the "ListenStream" key.  See
42       systemd.socket(5) for more information.
43
44       Also create a service unit (eg. /etc/systemd/system/nbdkit.service)
45       containing:
46
47        [Service]
48        ExecStart=/usr/sbin/nbdkit file /path/to/serve
49
50       For more information on systemd and socket activation, see
51       http://0pointer.de/blog/projects/socket-activation.html
52

LOGGING

54       Error messages from nbdkit can be sent to either standard error
55       (--log=stderr) or to the system log (--log=syslog).
56
57       The default, if --log is not specified on the command line, is to send
58       error messages to stderr, unless nbdkit forks into the background in
59       which case they are sent to syslog.
60
61       In detail:
62
63       Messages go to standard error (stderr):
64           When running from the command line in the foreground.
65
66           When using systemd socket activation.
67
68           Using --log=stderr forces all messages to go to standard error.
69
70       Messages go to the system log (syslog):
71           When running from the command line, forked into the background.
72
73           Using --log=syslog forces all messages to go to the system log.
74
75       Debug messages (-v/--verbose) always go to standard error and are never
76       sent to the system log.
77

ENVIRONMENT VARIABLES

79       "LISTEN_FDS"
80       "LISTEN_PID"
81           If present in the environment when nbdkit starts up, these trigger
82           "SOCKET ACTIVATION".
83

SEE ALSO

85       nbdkit(1), systemd(1), systemd.socket(5), syslog(3), rsyslogd(8),
86       journalctl(1).
87

AUTHORS

89       Eric Blake
90
91       Richard W.M. Jones
92
93       Pino Toscano
94
96       Copyright (C) 2013-2018 Red Hat Inc.
97

LICENSE

99       Redistribution and use in source and binary forms, with or without
100       modification, are permitted provided that the following conditions are
101       met:
102
103       ·   Redistributions of source code must retain the above copyright
104           notice, this list of conditions and the following disclaimer.
105
106       ·   Redistributions in binary form must reproduce the above copyright
107           notice, this list of conditions and the following disclaimer in the
108           documentation and/or other materials provided with the
109           distribution.
110
111       ·   Neither the name of Red Hat nor the names of its contributors may
112           be used to endorse or promote products derived from this software
113           without specific prior written permission.
114
115       THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND ANY
116       EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
117       IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
118       PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR CONTRIBUTORS BE
119       LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
120       CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
121       SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
122       BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
123       WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
124       OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
125       ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
126
127
128
129nbdkit-1.12.3                     2019-05-21                 nbdkit-service(1)
Impressum