summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2014-08-19 10:05:05 -0400
committerSteve Dickson <steved@redhat.com>2014-08-19 10:05:05 -0400
commit00bb6d244cbf4a09fdbd3fce2a3d57986087d928 (patch)
tree9329569cccc01411d8df79dec42e23f79a8351eb
parentf7b42b9e32102c153b3effb875d7a98ad795502f (diff)
downloadnfs-utils-00bb6d244cbf4a09fdbd3fce2a3d57986087d928.tar.gz
nfs-utils-00bb6d244cbf4a09fdbd3fce2a3d57986087d928.tar.xz
nfs-utils-00bb6d244cbf4a09fdbd3fce2a3d57986087d928.zip
start-statd: clean up output when systemd is not installed
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> Signed-off-by: Steve Dickson <steved@redhat.com>
-rwxr-xr-x[-rw-r--r--]utils/statd/start-statd14
1 files changed, 9 insertions, 5 deletions
diff --git a/utils/statd/start-statd b/utils/statd/start-statd
index dcdaf77..ec9383b 100644..100755
--- 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