From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 332BE139085 for ; Mon, 16 Jan 2017 12:25:47 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 02FB221C07C; Mon, 16 Jan 2017 12:25:46 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id C086221C07C for ; Mon, 16 Jan 2017 12:25:45 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 2D090340988 for ; Mon, 16 Jan 2017 12:25:44 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 377C024EA for ; Mon, 16 Jan 2017 12:25:41 +0000 (UTC) From: "Slawek Lis" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Slawek Lis" Message-ID: <1484569522.33f785f6d2650b7bd8556bb58c95468b4d3a0ac1.slis@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: net-analyzer/suricata/files/ X-VCS-Repository: repo/gentoo X-VCS-Files: net-analyzer/suricata/files/suricata-3.2-init X-VCS-Directories: net-analyzer/suricata/files/ X-VCS-Committer: slis X-VCS-Committer-Name: Slawek Lis X-VCS-Revision: 33f785f6d2650b7bd8556bb58c95468b4d3a0ac1 X-VCS-Branch: master Date: Mon, 16 Jan 2017 12:25:41 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 334d8c02-f71b-451a-b087-0ee6aa95643f X-Archives-Hash: 71357468609306abdbbe26f8547db453 commit: 33f785f6d2650b7bd8556bb58c95468b4d3a0ac1 Author: Slawomir Lis gentoo org> AuthorDate: Mon Jan 16 12:25:22 2017 +0000 Commit: Slawek Lis gentoo org> CommitDate: Mon Jan 16 12:25:22 2017 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=33f785f6 net-analyzer/suricata: updated init script As reported in bug #605754, updated init script stop() function to take correct method of stopping long-running suricata shutdown Reported-by: Vieri yahoo.com> Package-Manager: Portage-2.3.3, Repoman-2.3.1 net-analyzer/suricata/files/suricata-3.2-init | 36 +++------------------------ 1 file changed, 4 insertions(+), 32 deletions(-) diff --git a/net-analyzer/suricata/files/suricata-3.2-init b/net-analyzer/suricata/files/suricata-3.2-init index 9ffedf4..05f05dd 100644 --- a/net-analyzer/suricata/files/suricata-3.2-init +++ b/net-analyzer/suricata/files/suricata-3.2-init @@ -1,5 +1,5 @@ #!/sbin/openrc-run -# Copyright 1999-2016 Gentoo Foundation +# Copyright 1999-2017 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id$ @@ -27,6 +27,7 @@ fi SURICATAUSER=${SURICATAUSER:-${SURICATA_USER}} SURICATAGROUP=${SURICATAGROUP:-${SURICATA_GROUP}} [ -e ${SURICATACONF} ] && SURICATAOPTS="-c ${SURICATACONF} ${SURICATAOPTS}" +[[ -z "${SURICATA_MAX_WAIT_ON_STOP// }" ]] || SURICATA_RETRY="--retry ${SURICATA_MAX_WAIT_ON_STOP}" description="Suricata IDS/IPS" extra_commands="checkconfig dump" @@ -111,37 +112,8 @@ start() { stop() { ebegin "Stopping ${SVCNAME}" - initpidinfo - start-stop-daemon --stop --quiet --pidfile ${SURICATAPID} >/dev/null 2>&1 - einfo "Waiting for ${SVCNAME} to shut down. This can take a while..." - # max wait: 5 minutes as it can take quite a while on some systems with heavy traffic - local cnt=300 - while [ -e ${SURICATAPID} ] && [ $cnt -gt 0 ]; do - cnt=$(expr $cnt - 1) - sleep 1 - echo -ne "$cnt seconds left before we give up checking the PID file...\r" - done - # under certain conditions suricata can be pretty slow and the PID can persist long after the pidfile has been removed - # max wait for process to terminate: 1 minute - if [ ${#SUR_PID} -gt 0 ]; then - cnt=60 - SUR_PID_CHECK="$(ps -eo pid | grep -c ${SUR_PID})" - if [ $((SUR_PID_CHECK)) -ne 0 ]; then - einfo "The PID file ${SURICATAPID} is gone but the ${SVCNAME} PID ${SUR_PID} is still running." - einfo "Waiting for process to shut down on its own. This can take a while..." - fi - while [ $((SUR_PID_CHECK)) -ne 0 ]; do - cnt=$(expr $cnt - 1) - if [ $cnt -lt 1 ] ; then - eend 1 "Failed. You might need to kill PID ${SUR_PID} or find out why it can't be stopped." - break - fi - sleep 1 - echo -ne "$cnt seconds left before we give up checking PID ${SUR_PID}...\r" - SUR_PID_CHECK="$(ps -eo pid | grep -c ${SUR_PID})" - done - fi - eend 0 + start-stop-daemon --stop ${SURICATA_RETRY} --quiet --pidfile ${SURICATAPID} >/dev/null 2>&1 + eend $? } reload() {