Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 4 Oct 2013 12:37:59 +0000 (UTC)
From:      Dmitry Sivachenko <demon@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r329298 - in head/net: haproxy-devel/files haproxy/files
Message-ID:  <201310041237.r94CbxTc034841@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: demon
Date: Fri Oct  4 12:37:58 2013
New Revision: 329298
URL: http://svnweb.freebsd.org/changeset/ports/329298

Log:
  If running with nbproc > 1, haproxy spawns several processes and writes their
  pids to $pidfile (one pid per line).
  Our check_pidfile() from rc.subr will get only first pid and use it for
  stop/status/etc which is incorrect.
  
  Do not use pidfile for that, rather use $procname to get the list of running
  haproxy processes.
  
  [If you know how to do the same with pidfile, please tell me.]

Modified:
  head/net/haproxy-devel/files/haproxy.in
  head/net/haproxy/files/haproxy.in

Modified: head/net/haproxy-devel/files/haproxy.in
==============================================================================
--- head/net/haproxy-devel/files/haproxy.in	Fri Oct  4 12:35:10 2013	(r329297)
+++ head/net/haproxy-devel/files/haproxy.in	Fri Oct  4 12:37:58 2013	(r329298)
@@ -43,9 +43,10 @@ command="%%PREFIX%%/sbin/haproxy"
 # Load Configs/Set Defaults
 load_rc_config $name
 : ${haproxy_enable:="NO"}
-pidfile=${haproxy_pidfile:-"/var/run/haproxy.pid"}
+: ${haproxy_pidfile:="/var/run/haproxy.pid"}
 : ${haproxy_config:="%%PREFIX%%/etc/${name}.conf"}
-: ${haproxy_flags="-q -f ${haproxy_config} -p ${pidfile}"}
+: ${haproxy_flags="-q -f ${haproxy_config} -p ${haproxy_pidfile}"}
+procname=${command}
 
 # Update the globals
 required_files=$haproxy_config
@@ -67,8 +68,8 @@ haproxy_reload()
 	if [ $? -ne 0 ]; then
 	    err 1 "Error found in ${haproxy_config} - not reloading current process!"
 	fi
-	rc_pid=$(check_pidfile ${pidfile} ${command})
-	if [ $rc_pid ]; then
+	rc_pid=$(check_process ${procname})
+	if [ -n "$rc_pid" ]; then
 		if [ $rc_force ]; then
 			${command} ${haproxy_flags} -st ${rc_pid}
 		else

Modified: head/net/haproxy/files/haproxy.in
==============================================================================
--- head/net/haproxy/files/haproxy.in	Fri Oct  4 12:35:10 2013	(r329297)
+++ head/net/haproxy/files/haproxy.in	Fri Oct  4 12:37:58 2013	(r329298)
@@ -43,9 +43,10 @@ command="%%PREFIX%%/sbin/haproxy"
 # Load Configs/Set Defaults
 load_rc_config $name
 : ${haproxy_enable:="NO"}
-pidfile=${haproxy_pidfile:-"/var/run/haproxy.pid"}
+: ${haproxy_pidfile:="/var/run/haproxy.pid"}
 : ${haproxy_config:="%%PREFIX%%/etc/${name}.conf"}
-: ${haproxy_flags="-q -f ${haproxy_config} -p ${pidfile}"}
+: ${haproxy_flags="-q -f ${haproxy_config} -p ${haproxy_pidfile}"}
+procname=${command}
 
 # Update the globals
 required_files=$haproxy_config
@@ -67,8 +68,8 @@ haproxy_reload()
 	if [ $? -ne 0 ]; then
 	    err 1 "Error found in ${haproxy_config} - not reloading current process!"
 	fi
-	rc_pid=$(check_pidfile ${pidfile} ${command})
-	if [ $rc_pid ]; then
+	rc_pid=$(check_process ${procname})
+	if [ -n "$rc_pid" ]; then
 		if [ $rc_force ]; then
 			${command} ${haproxy_flags} -st ${rc_pid}
 		else



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201310041237.r94CbxTc034841>