linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff Layton <jlayton@kernel.org>
To: Steve Dickson <steved@redhat.com>,
	 Lorenzo Bianconi <lorenzo@kernel.org>,
	Chuck Lever <chuck.lever@oracle.com>,  Neil Brown <neilb@suse.de>
Cc: linux-nfs@vger.kernel.org, Jeff Layton <jlayton@kernel.org>
Subject: [PATCH nfs-utils v2 4/4] systemd: use nfsdctl to start and stop the nfs server
Date: Tue, 16 Apr 2024 12:48:50 -0400	[thread overview]
Message-ID: <20240416-nfsdctl-v2-4-9a4367b710d2@kernel.org> (raw)
In-Reply-To: <20240416-nfsdctl-v2-0-9a4367b710d2@kernel.org>

Attempt to use nfsdctl to start and stop the nfs-server. If that fails
for any reason, use rpc.nfsd to do it instead.

Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
 systemd/nfs-server.service | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/systemd/nfs-server.service b/systemd/nfs-server.service
index ac17d5286d3b..8793856aa707 100644
--- a/systemd/nfs-server.service
+++ b/systemd/nfs-server.service
@@ -23,8 +23,8 @@ After=rpc-gssd.service gssproxy.service rpc-svcgssd.service
 Type=oneshot
 RemainAfterExit=yes
 ExecStartPre=-/usr/sbin/exportfs -r
-ExecStart=/usr/sbin/rpc.nfsd
-ExecStop=/usr/sbin/rpc.nfsd 0
+ExecStart=/bin/sh -c '/usr/sbin/nfsdctl autostart || /usr/sbin/rpc.nfsd'
+ExecStop=/bin/sh -c '/usr/sbin/nfsdctl threads 0 || /usr/sbin/rpc.nfsd 0'
 ExecStopPost=/usr/sbin/exportfs -au
 ExecStopPost=/usr/sbin/exportfs -f
 

-- 
2.44.0


  parent reply	other threads:[~2024-04-16 16:49 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-16 16:48 [PATCH nfs-utils v2 0/4] nfsdctl: new nfs-utils tool for managing the kernel NFS server Jeff Layton
2024-04-16 16:48 ` [PATCH nfs-utils v2 1/4] nfsdctl: add the nfsdctl utility to nfs-utils Jeff Layton
2024-04-16 16:48 ` [PATCH nfs-utils v2 2/4] nfsdctl: convert it to a command-line based interface Jeff Layton
2024-04-16 16:48 ` [PATCH nfs-utils v2 3/4] nfsdctl: asciidoc source for the manpage Jeff Layton
2024-04-16 16:48 ` Jeff Layton [this message]
2024-04-21 12:17 ` [PATCH nfs-utils v2 0/4] nfsdctl: new nfs-utils tool for managing the kernel NFS server Steve Dickson
2024-04-23 11:44   ` Jeff Layton

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=20240416-nfsdctl-v2-4-9a4367b710d2@kernel.org \
    --to=jlayton@kernel.org \
    --cc=chuck.lever@oracle.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=lorenzo@kernel.org \
    --cc=neilb@suse.de \
    --cc=steved@redhat.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).