You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by km...@apache.org on 2018/08/25 01:48:46 UTC

svn commit: r1839006 - /spamassassin/trunk/contrib/kill-spamd.sh

Author: kmcgrail
Date: Sat Aug 25 01:48:46 2018
New Revision: 1839006

URL: http://svn.apache.org/viewvc?rev=1839006&view=rev
Log:
Adding contributed script to stop spamd

Added:
    spamassassin/trunk/contrib/kill-spamd.sh   (with props)

Added: spamassassin/trunk/contrib/kill-spamd.sh
URL: http://svn.apache.org/viewvc/spamassassin/trunk/contrib/kill-spamd.sh?rev=1839006&view=auto
==============================================================================
--- spamassassin/trunk/contrib/kill-spamd.sh (added)
+++ spamassassin/trunk/contrib/kill-spamd.sh Sat Aug 25 01:48:46 2018
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+PFILE=/var/run/spamd.pid
+
+if [[ -e $PFILE && ! -z $PFILE ]]; then
+	PID=$(cat $PFILE 2>/dev/null)
+	if [[ "$PID" =~ ^[0-9]+$ ]]; then
+		PROC="/proc/$PID/cmdline"
+		if [[ -e $PROC ]]; then
+			C=$(grep -c spamd $PROC)
+			if [[ "x$C" != "x0" ]]; then
+				echo "killing spamd process: $PID";
+				kill $PID;
+				exit $?
+			fi
+		fi
+	fi
+fi
+exit 1
\ No newline at end of file

Propchange: spamassassin/trunk/contrib/kill-spamd.sh
------------------------------------------------------------------------------
    svn:executable = *