851484
commit 8fef90084f3d19e90ba1bb22b8cd1d58ddaf6ef3
851484
Author: Steve Dickson <steved@redhat.com>
851484
Date:   Tue Jun 21 12:06:06 2016 -0400
851484
851484
    start-statd: Use flock to serialize the running of this script
851484
    
851484
    To once and for all stop multiple rpc.statd from
851484
    being started (mostly in HA environments), use
851484
    flock to serialize the running of the script
851484
    
851484
    Signed-off-by: Steve Dickson <steved@redhat.com>
851484
851484
diff --git a/utils/statd/start-statd b/utils/statd/start-statd
851484
index 19e6eb2..2fd6039 100755
851484
--- a/utils/statd/start-statd
851484
+++ b/utils/statd/start-statd
851484
@@ -6,6 +6,10 @@
851484
 # site.
851484
 PATH="/sbin:/usr/sbin:/bin:/usr/bin"
851484
 
851484
+# Use flock to serialize the running of this script
851484
+exec 200> /var/run/rpc.statd.lock
851484
+flock -e 200
851484
+
851484
 if [ -s /var/run/rpc.statd.pid ] &&
851484
        [ 1`cat /var/run/rpc.statd.pid` -gt 1 ] &&
851484
        kill -0 `cat /var/run/rpc.statd.pid` > /dev/null 2>&1