File: kill-spamd.sh

package info (click to toggle)
spamassassin 4.0.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 22,988 kB
  • sloc: perl: 88,863; ansic: 5,193; sh: 3,737; javascript: 339; sql: 295; makefile: 209; python: 49
file content (19 lines) | stat: -rwxr-xr-x 348 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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