All of lore.kernel.org
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.com>
To: Steve Dickson <SteveD@redhat.com>
Cc: libtirpc-devel@lists.sourceforge.net, linux-nfs@vger.kernel.org
Subject: [PATCH - rpcbind] Provide systemd unit files for rpcbind
Date: Wed, 12 Oct 2016 17:01:15 +1100	[thread overview]
Message-ID: <87oa2q14yc.fsf@notabene.neil.brown.name> (raw)

[-- Attachment #1: Type: text/plain, Size: 3441 bytes --]



To encourage uniformity across distributions, provide
systemd unit files.

If extra arguments are wanted for rpcbind, a drop-in should be used
to set the Environment= or read and EnvironmentFile=

As the "run" directory could be /run or /var/run we RequiresMountsFor
both of these.

rpcbind.service pulls in rpcbind.socket so that the listening sockets
chosen there will always be used.

Signed-off-by: NeilBrown <neilb@suse.com>
---
 .gitignore                 |  1 +
 Makefile.am                |  4 ++++
 configure.ac               |  7 ++++++-
 systemd/rpcbind.service.in | 17 +++++++++++++++++
 systemd/rpcbind.socket     | 19 +++++++++++++++++++
 5 files changed, 47 insertions(+), 1 deletion(-)
 create mode 100644 systemd/rpcbind.service.in
 create mode 100644 systemd/rpcbind.socket

hi,
 these are based on the unit files in use a SUSE, though I have made a
 few "improvements".
 If anyone has differences in their distros that you think we should
 have in mainline, I'd love to hear about it.

Thanks,
NeilBrown


diff --git a/.gitignore b/.gitignore
index 321dff64a57d..a8f1fed2acb6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -27,3 +27,4 @@ rpcbind
 rpcinfo
 # cscope database files
 cscope.*
+systemd/rpcbind.service
diff --git a/Makefile.am b/Makefile.am
index 5ec8cd66b689..43c27100ceae 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -50,6 +50,10 @@ if SYSTEMD
 AM_CPPFLAGS += $(SYSTEMD_CFLAGS) -DSYSTEMD
 
 rpcbind_LDADD += $(SYSTEMD_LIBS)
+
+systemdsystemunit_DATA = \
+	systemd/rpcbind.service \
+	systemd/rpcbind.socket
 endif
 
 rpcinfo_SOURCES =       src/rpcinfo.c
diff --git a/configure.ac b/configure.ac
index af4b74b31c9a..0892d8246a12 100644
--- a/configure.ac
+++ b/configure.ac
@@ -61,4 +61,9 @@ AC_SEARCH_LIBS([pthread_create], [pthread])
 
 AC_CHECK_HEADERS([nss.h rpcsvc/mount.h])
 
-AC_OUTPUT([Makefile])
+# make bindir available for substitution in config file
+# 2 "evals" needed to expand variable names
+AC_SUBST([_bindir])
+AC_CONFIG_COMMANDS_PRE([eval eval _bindir=$bindir])
+
+AC_OUTPUT([Makefile systemd/rpcbind.service])
diff --git a/systemd/rpcbind.service.in b/systemd/rpcbind.service.in
new file mode 100644
index 000000000000..4706b5a77abf
--- /dev/null
+++ b/systemd/rpcbind.service.in
@@ -0,0 +1,17 @@
+[Unit]
+Description=RPC Bind
+Documentation=man:rpcbind(8)
+DefaultDependencies=no
+RequiresMountsFor=/var/run /run
+# Make sure we use the IP addresses listed for
+# rpcbind.socket, no matter how this unit is started.
+Wants=rpcbind.socket
+After=rpcbind.socket
+
+[Service]
+Type=notify
+# distro can provide a drop-in adding EnvironmentFile=-/??? if needed.
+ExecStart=@_bindir@/rpcbind $RPCBIND_OPTIONS -w -f
+
+[Install]
+WantedBy=multi-user.target
diff --git a/systemd/rpcbind.socket b/systemd/rpcbind.socket
new file mode 100644
index 000000000000..7204c97efa6f
--- /dev/null
+++ b/systemd/rpcbind.socket
@@ -0,0 +1,19 @@
+[Unit]
+Description=RPCbind Server Activation Socket
+DefaultDependencies=no
+RequiresMountsFor=/var/run /run
+Wants=rpcbind.target
+Before=rpcbind.target
+
+[Socket]
+ListenStream=/var/run/rpcbind.sock
+
+# RPC netconfig can't handle ipv6/ipv4 dual sockets
+BindIPv6Only=ipv6-only
+ListenStream=0.0.0.0:111
+ListenDatagram=0.0.0.0:111
+ListenStream=[::]:111
+ListenDatagram=[::]:111
+
+[Install]
+WantedBy=sockets.target
-- 
2.10.0


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 800 bytes --]

             reply	other threads:[~2016-10-12 10:45 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-12  6:01 NeilBrown [this message]
2016-11-01 16:51 ` [PATCH - rpcbind] Provide systemd unit files for rpcbind Steve Dickson
2016-11-01 19:57   ` NeilBrown
2016-11-01 20:04   ` NeilBrown
2016-11-02 13:27     ` Steve Dickson
2016-11-02 13:49       ` [Libtirpc-devel] " Thorsten Kukuk
2016-11-02 18:06         ` Steve Dickson
2016-11-02 21:16           ` NeilBrown
2016-11-02 21:31             ` Steve Dickson
2016-11-03  0:22               ` NeilBrown
2016-11-07 19:36                 ` Steve Dickson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87oa2q14yc.fsf@notabene.neil.brown.name \
    --to=neilb@suse.com \
    --cc=SteveD@redhat.com \
    --cc=libtirpc-devel@lists.sourceforge.net \
    --cc=linux-nfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.