All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mike Frysinger <vapier@gentoo.org>
To: linux-nfs@vger.kernel.org
Subject: [PATCH nfs-utils] start-statd: clean up output when systemd is not installed
Date: Sun, 17 Aug 2014 10:44:08 -0400	[thread overview]
Message-ID: <1408286648-19031-1-git-send-email-vapier@gentoo.org> (raw)

If you don't have systemd, then this script dumps:
/usr/sbin/start-statd: line 8: systemctl: command not found

This isn't terribly useful since we ultimately fall back to running
the daemon ourselves, so probe for systemd's existence before we try
to use it.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
 utils/statd/start-statd | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)
 mode change 100644 => 100755 utils/statd/start-statd

diff --git a/utils/statd/start-statd b/utils/statd/start-statd
old mode 100644
new mode 100755
index dcdaf77..ec9383b
--- a/utils/statd/start-statd
+++ b/utils/statd/start-statd
@@ -1,12 +1,16 @@
-#!/bin/bash -p
+#!/bin/sh
 # nfsmount calls this script when mounting a filesystem with locking
 # enabled, but when statd does not seem to be running (based on
 # /var/run/rpc.statd.pid).
 # It should run statd with whatever flags are apropriate for this
 # site.
 PATH="/sbin:/usr/sbin:/bin:/usr/bin"
-if systemctl start rpc-statd.service
-then :
-else
-    exec rpc.statd --no-notify
+
+# First try systemd if it's installed.
+if systemctl --help >/dev/null 2>&1; then
+    # Quit only if the call worked.
+    systemctl start rpc-statd.service && exit
 fi
+
+# Fall back to launching it ourselves.
+exec rpc.statd --no-notify
-- 
2.0.0


             reply	other threads:[~2014-08-17 14:44 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-17 14:44 Mike Frysinger [this message]
2014-08-18 17:04 ` [PATCH nfs-utils] start-statd: clean up output when systemd is not installed Steve Dickson
2014-08-18 23:57   ` Mike Frysinger
2014-08-19  1:06     ` NeilBrown
2014-08-19  3:28       ` Mike Frysinger
2014-08-19 14:06     ` 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=1408286648-19031-1-git-send-email-vapier@gentoo.org \
    --to=vapier@gentoo.org \
    --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.