summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Dickson <steved@redhat.com>2016-06-21 12:06:06 -0400
committerSteve Dickson <steved@redhat.com>2016-06-21 12:07:50 -0400
commit8fef90084f3d19e90ba1bb22b8cd1d58ddaf6ef3 (patch)
tree4998bd3428f1a8397a543ead9082563c45d20f6c
parentfd2e0c51fed171f3a639fdfc106731c0ff6f9757 (diff)
downloadnfs-utils-8fef90084f3d19e90ba1bb22b8cd1d58ddaf6ef3.tar.gz
start-statd: Use flock to serialize the running of this script
To once and for all stop multiple rpc.statd from being started (mostly in HA environments), use flock to serialize the running of the script Signed-off-by: Steve Dickson <steved@redhat.com>
-rwxr-xr-xutils/statd/start-statd4
1 files changed, 4 insertions, 0 deletions
diff --git a/utils/statd/start-statd b/utils/statd/start-statd
index 19e6eb2..2fd6039 100755
--- a/utils/statd/start-statd
+++ b/utils/statd/start-statd
@@ -6,6 +6,10 @@
# site.
PATH="/sbin:/usr/sbin:/bin:/usr/bin"
+# Use flock to serialize the running of this script
+exec 200> /var/run/rpc.statd.lock
+flock -e 200
+
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