From owner-svn-ports-all@freebsd.org Wed Aug 16 08:06:59 2017 Return-Path: Delivered-To: svn-ports-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6518BDCC55C; Wed, 16 Aug 2017 08:06:59 +0000 (UTC) (envelope-from demon@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3B71175009; Wed, 16 Aug 2017 08:06:59 +0000 (UTC) (envelope-from demon@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7G86wl1016879; Wed, 16 Aug 2017 08:06:58 GMT (envelope-from demon@FreeBSD.org) Received: (from demon@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7G86wJR016877; Wed, 16 Aug 2017 08:06:58 GMT (envelope-from demon@FreeBSD.org) Message-Id: <201708160806.v7G86wJR016877@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: demon set sender to demon@FreeBSD.org using -f From: Dmitry Sivachenko Date: Wed, 16 Aug 2017 08:06:58 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r448026 - in head/net: haproxy-devel/files haproxy/files X-SVN-Group: ports-head X-SVN-Commit-Author: demon X-SVN-Commit-Paths: in head/net: haproxy-devel/files haproxy/files X-SVN-Commit-Revision: 448026 X-SVN-Commit-Repository: ports MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the ports tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Aug 2017 08:06:59 -0000 Author: demon Date: Wed Aug 16 08:06:57 2017 New Revision: 448026 URL: https://svnweb.freebsd.org/changeset/ports/448026 Log: Add hardstop/hardreload commands to rc script (to stop/reload haproxy without waiting for existing connections to close). PR: 221402 Submitted by: Frank Wall 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 Wed Aug 16 07:34:22 2017 (r448025) +++ head/net/haproxy-devel/files/haproxy.in Wed Aug 16 08:06:57 2017 (r448026) @@ -29,18 +29,28 @@ name="haproxy" rcvar=haproxy_enable command="%%PREFIX%%/sbin/haproxy" -extra_commands="reload configtest" +extra_commands="reload configtest hardstop hardreload" reload_cmd="haproxy_reload" +hardreload_cmd="haproxy_reload" +hardreload_precmd="def_hardreload_option" stop_cmd="haproxy_stop" +hardstop_cmd="haproxy_stop" +hardstop_precmd="def_hardstop_signal" : ${haproxy_enable:="NO"} : ${haproxy_config:="%%PREFIX%%/etc/${name}.conf"} pidfile=${haproxy_pidfile:-"/var/run/haproxy.pid"} -if [ -z "$rc_force" ]; then - sig_stop="USR1" -fi +def_hardreload_option() +{ + reload_opt="-st" +} +def_hardstop_signal() +{ + sig_stop="TERM" +} + load_rc_config $name is_valid_profile() { @@ -81,6 +91,8 @@ fi configtest_cmd="$command -c -f $haproxy_config" start_precmd="$command -q -c -f $haproxy_config" required_files=$haproxy_config +sig_stop=SIGUSR1 +reload_opt="-sf" haproxy_reload() { @@ -90,11 +102,7 @@ haproxy_reload() fi rc_pid=$(check_pidfile ${pidfile} ${command}) if [ $rc_pid ]; then - if [ -z "$rc_force" ]; then - ${command} ${haproxy_flags} -sf $(cat ${pidfile}) - else - ${command} ${haproxy_flags} -st $(cat ${pidfile}) - fi + ${command} ${haproxy_flags} $reload_opt $(cat ${pidfile}) else _run_rc_notrunning return 1 Modified: head/net/haproxy/files/haproxy.in ============================================================================== --- head/net/haproxy/files/haproxy.in Wed Aug 16 07:34:22 2017 (r448025) +++ head/net/haproxy/files/haproxy.in Wed Aug 16 08:06:57 2017 (r448026) @@ -29,18 +29,28 @@ name="haproxy" rcvar=haproxy_enable command="%%PREFIX%%/sbin/haproxy" -extra_commands="reload configtest" +extra_commands="reload configtest hardstop hardreload" reload_cmd="haproxy_reload" +hardreload_cmd="haproxy_reload" +hardreload_precmd="def_hardreload_option" stop_cmd="haproxy_stop" +hardstop_cmd="haproxy_stop" +hardstop_precmd="def_hardstop_signal" : ${haproxy_enable:="NO"} : ${haproxy_config:="%%PREFIX%%/etc/${name}.conf"} pidfile=${haproxy_pidfile:-"/var/run/haproxy.pid"} -if [ -z "$rc_force" ]; then - sig_stop="USR1" -fi +def_hardreload_option() +{ + reload_opt="-st" +} +def_hardstop_signal() +{ + sig_stop="TERM" +} + load_rc_config $name is_valid_profile() { @@ -81,6 +91,8 @@ fi configtest_cmd="$command -c -f $haproxy_config" start_precmd="$command -q -c -f $haproxy_config" required_files=$haproxy_config +sig_stop=SIGUSR1 +reload_opt="-sf" haproxy_reload() { @@ -90,11 +102,7 @@ haproxy_reload() fi rc_pid=$(check_pidfile ${pidfile} ${command}) if [ $rc_pid ]; then - if [ -z "$rc_force" ]; then - ${command} ${haproxy_flags} -sf $(cat ${pidfile}) - else - ${command} ${haproxy_flags} -st $(cat ${pidfile}) - fi + ${command} ${haproxy_flags} $reload_opt $(cat ${pidfile}) else _run_rc_notrunning return 1