GithubHelp home page GithubHelp logo

Comments (3)

sergeyfd avatar sergeyfd commented on August 18, 2024

A good patch that definitely makes sense in my opinion.

from resource-agents.

dmuhamedagic avatar dmuhamedagic commented on August 18, 2024

On Thu, Sep 20, 2012 at 06:40:14AM -0700, Timur Bakeyev wrote:

I was trying to use named RA from the GIT repository to get redundant DNS server(s) in my environment. Cluster is running on Debian 6.0 Squeeze with the stock corosync/pacemaker.

Configuration looks like:

primitive named ocf:heartbeat:named \
        params named_user="bind" named_config="/etc/bind/named.conf" monitor_request="ns.domain.nl" monitor_response="10.0.0.201" \
        op monitor interval="20s" timeout="30s" \
        op start interval="0" timeout="60s" \
        op stop interval="0" timeout="60s"
clone run_named named \
        meta clone-max="2" clone-node-max="1" target-role="Started"
colocation use_named inf: ip_int run_named
order activate_named inf: ip_int:start run_named:start

Log file showed that named is starting normally, but immediately gets killed. A bit of debugging of the RA revealed that although named is starting OK the following code that supposed to find it in the list of running processes fails to do so on whatever reason and named considered dead, effectively disabling RA:

pid=`ps -e -o pid,command,args | grep "$pattern" | grep -v grep | awk '{print $1}'`

It would be interesting to find out why this didn't work. Was
there "grep" somewhere in the ps output? Did you try to debug
this peace of code (if you 'set -x/set +x' surround the critical
part, it would be captured by lrmd and logged).

Running the same sequence(with expanded $pattern) from the command line perfectly worked and returned the PID of the named process.

I've tried to simplify the expression and replaced it with:

pid=`pgrep -f "$pattern"`

Which is a functional equivalent of the previous command.

Amusingly enough it worked fine and RA for the last two months didn't cause any problems.

Grepping RAs shows that at least 10 of them use "pgrep", so I'd consider it's presence in the system a hard dependency anyhow.

--- /root/GIT/resource-agents/heartbeat/named   2012-03-13 18:35:01.000000000 +0100
+++ named       2012-08-03 06:10:01.000000000 +0200
@@ -247,7 +247,7 @@
        pattern="$pattern.*-c $OCF_RESKEY_named_config"
     fi

-    pid=`ps -e -o pid,command,args | grep "$pattern" | grep -v grep | awk '{print $1}'`
+    pid=`pgrep -f "$pattern"`
     echo $pid
 }

This patch looks fine to me.

from resource-agents.

dmuhamedagic avatar dmuhamedagic commented on August 18, 2024

Applied:

commit 7f2c3e9
Author: Serge Dubrouski [email protected]
Date: Wed Oct 3 15:46:49 2012 +0200

Medium: named: use pgrep instead of searching in ps(1) output (thanks to Timur Bakeyev)

from resource-agents.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.