diff mbox

[1/1] start-statd: Use flock to serialize the running of this script

Message ID 1466441099-16166-1-git-send-email-steved@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Steve Dickson June 20, 2016, 4:44 p.m. UTC
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>
---
 utils/statd/start-statd | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Steve Dickson June 21, 2016, 4:09 p.m. UTC | #1
On 06/20/2016 12:44 PM, Steve Dickson wrote:
> 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>
Committed... 

steved.
> ---
>  utils/statd/start-statd | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> 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
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

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