From patchwork Thu May 2 01:03:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Schantl X-Patchwork-Id: 2234 Return-Path: Received: from mail01.ipfire.org (unknown [172.28.1.200]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mail01.ipfire.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by web07.i.ipfire.org (Postfix) with ESMTPS id A754F85BD82 for ; Wed, 1 May 2019 16:03:12 +0100 (BST) Received: from mail01.i.ipfire.org (localhost [IPv6:::1]) by mail01.ipfire.org (Postfix) with ESMTP id 44vM8Z5rgbz5DSVl; Wed, 1 May 2019 16:03:10 +0100 (BST) Received: from tuxedo.stevee (213162073179.public.t-mobile.at [213.162.73.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mail01.ipfire.org (Postfix) with ESMTPSA id 44vM8X5kHKz55Jp1; Wed, 1 May 2019 16:03:08 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=201904rsa; t=1556722989; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:references:openpgp:autocrypt; bh=EZcegEsZXMbJo/ccUbh1fIF0yeLyG1baY0e6mPPCO34=; b=UUc7m3tVlzvRIXxVEbrVvfUC3tYhF/0S4DdECv6EOi+rsEuezQvsyuqfrpJm7GsAuE2x7r MR4v8TKYnaInU7aUV+eNHfW2q64VDBIn2EULPeDKfyleGm7imCy6f+Z9+KswY6czTruEF5 4w5iSbw8S0yXlQPrj4ELp24X2K53QxYfkdTg3aH30xbvB80X/2lxu5wlgajBYQaxJ8RT2C P6N8YFCiBkqqv+iG/87i/cYJZk2NV7uhoRz3OPZQtbksEDXMrNiwWFU1Bg6uXIuMuY03SP CCw30PSJuBecu5BWsZwbemIWb7lIDjoSUHZ7jGjS0YwfagBvMY5HDRap33I0Sg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=201904ed25519; t=1556722989; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:references:openpgp:autocrypt; bh=EZcegEsZXMbJo/ccUbh1fIF0yeLyG1baY0e6mPPCO34=; b=VHp6+mEuzIeuUZ97Kh01LauiCLAiUNZhHcq1QUESS6b1ejwO8sA3HZx87f3VpAkRIMJYu9 z6I6fQFptmRE4xCQ== From: Stefan Schantl To: development@lists.ipfire.org Subject: [PATCH] suricata: Remove PID file on stop Date: Wed, 1 May 2019 17:03:06 +0200 Message-Id: <20190501150306.4230-1-stefan.schantl@ipfire.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Authentication-Results: mail01.ipfire.org; auth=pass smtp.auth=stevee smtp.mailfrom=stefan.schantl@ipfire.org X-BeenThere: development@lists.ipfire.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: IPFire development talk List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: development-bounces@lists.ipfire.org Sender: "Development" Force the initscript to remove the PID file when calling "stop" section. If suricata crashes during startup, the PID file still remains and the service cannot be started anymore until the file has been deleted. Now when calling "stop" or "restart" the PID file will be deleted and the service can be used again. Fixes #12067. Signed-off-by: Stefan Schantl --- src/initscripts/system/suricata | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/initscripts/system/suricata b/src/initscripts/system/suricata index c9f131fca..38b6a40d8 100644 --- a/src/initscripts/system/suricata +++ b/src/initscripts/system/suricata @@ -171,6 +171,9 @@ case "$1" in # Remove suricata control socket. rm /var/run/suricata/* >/dev/null 2>/dev/null + # Trash remain pid file if still exists. + rm -f $PID_FILE >/dev/null 2>/dev/null + # Don't report returncode of rm if suricata was not started exit 0 ;;