Le jeudi 18 août 2011 13:43:20, Lars Ellenberg a écrit :

> > So yes, your patch is good. Acked-by lars ;-)

Oh thanks :)

> Oh, these monologues...
> 
> > > > --- conntrackd  2011-08-18 12:12:36.807562142 +0200
> > > > +++ /usr/lib/ocf/resource.d/heartbeat/conntrackd        2011-08-18
> > > > 12:25:20.000000000 +0200 @@ -111,8 +111,10 @@
> > > > 
> > > >  conntrackd_monitor() {
> > > >  
> > > >         rc=$OCF_NOT_RUNNING
> > > > 
> > > > -       # It does not write a PID file, so check with pgrep
> > > > -       pgrep -f $OCF_RESKEY_binary && rc=$OCF_SUCCESS
> > > > +        # It does not write a PID file, so check the socket exists
> > > > after +        # extracting its path from the configuration file
> > > > +        local conntrack_socket=$(awk '/^ *UNIX *{/,/^ *}/ { if ($0 ~
> > > > /^ *Path /) { print $2 } }' $OCF_RESKEY_config)
> 
> Is "space" really the only allowed white space there?
> I guess the regex has to be changed to use [[:space:]]*

Well I don't know about that but I guess we shouldn't take any chance. 
Unfortunately, awk doesn't know about [[:space:]]. I would have used [ \t\n] 
instead but I'm not sure blank lines in the middle of statements are allowed 
so, for the sake of clarity, I replaced them with [ \t] only.
-- 
Albéric de Pertat
ADELUX: http://www.adelux.fr
Tel: 01 40 86 45 81
GPG: http://www.adelux.fr/societe/gpg/alberic.asc
--- conntrackd	2011-08-18 12:12:36.807562142 +0200
+++ /usr/lib/ocf/resource.d/heartbeat/conntrackd	2011-08-18 14:14:48.000000000 +0200
@@ -111,8 +111,10 @@
 
 conntrackd_monitor() {
 	rc=$OCF_NOT_RUNNING
-	# It does not write a PID file, so check with pgrep
-	pgrep -f $OCF_RESKEY_binary && rc=$OCF_SUCCESS
+        # It does not write a PID file, so check the socket exists after
+        # extracting its path from the configuration file
+        local conntrack_socket=$(awk '/^[ \t]*UNIX[ \t]*{/,/^[ \t]*}/ { if ($1 == "Path") { print $2 } }' $OCF_RESKEY_config)
+        [ -S $conntrack_socket ] && rc=$OCF_SUCCESS
 	if [ "$rc" -eq "$OCF_SUCCESS" ]; then
 		# conntrackd is running 
 		# now see if it acceppts queries

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________________
Linux-HA-Dev: [email protected]
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/

Reply via email to