diff options
author | NeilBrown <neilb@suse.com> | 2016-01-16 12:09:50 -0500 |
---|---|---|
committer | Steve Dickson <steved@redhat.com> | 2016-01-16 12:30:13 -0500 |
commit | d92017cccaffb02f7f4e00d0fdd6ef5042bb6341 (patch) | |
tree | d89a00ae0be6ce33ac768d62e2a57d8babc61312 | |
parent | 37cd45cb913403b9f3b0c2aaa705e06cd70cc1d7 (diff) | |
download | nfs-utils-d92017cccaffb02f7f4e00d0fdd6ef5042bb6341.tar.gz nfs-utils-d92017cccaffb02f7f4e00d0fdd6ef5042bb6341.tar.xz nfs-utils-d92017cccaffb02f7f4e00d0fdd6ef5042bb6341.zip |
start-statd: don't run multiple rpc.statds on the one host.
If rpc.statd is running but slow to respond, mount.nfs will
run "start-statd" which might start a new statd. This is not a good
ideas as can result in lots of rpc.statds.
So inf start-statd check the pid file and if rpc.statd seems to be
running, exit with success.
(also "cd /" before running rpc.statd, just in case).
Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Steve Dickson <steved@redhat.com>
-rwxr-xr-x | utils/statd/start-statd | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/utils/statd/start-statd b/utils/statd/start-statd index 14369e5..19e6eb2 100755 --- a/utils/statd/start-statd +++ b/utils/statd/start-statd @@ -6,11 +6,19 @@ # site. PATH="/sbin:/usr/sbin:/bin:/usr/bin" +if [ -s /var/run/rpc.statd.pid ] && + [ 1`cat /var/run/rpc.statd.pid` -gt 1 ] && + kill -0 `cat /var/run/rpc.statd.pid` > /dev/null 2>&1 +then + # statd already running - must have been slow to respond. + exit 0 +fi # First try systemd if it's installed. if [ -d /run/systemd/system ]; then # Quit only if the call worked. systemctl start rpc-statd.service && exit fi +cd / # Fall back to launching it ourselves. exec rpc.statd --no-notify |