summaryrefslogtreecommitdiffstats
path: root/mail/dk-milter/files/milter-dk.sh.in
blob: 702efab14bde0bf698ac05e4e92a4c77a5c4930c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/sh
#
# $FreeBSD$
# 
if ! test -x %%PREFIX%%/libexec/dk-filter
then
	exit 0
fi
dk_filter_args="-d example.com -c nofws -H -m MSA -s /var/db/domainkeys/default.key.pem -S default"
case "$1" in
start)
	sh "${0}" wait
	rm -f /var/run/dk-filter.pid /var/run/dk-filter
	%%PREFIX%%/libexec/dk-filter -l -p local:/var/run/dk-filter \
		-P /var/run/dk-filter.pid ${dk_filter_args}
	echo -n ' dk-filter'
	;;
stop)
	if test -r /var/run/dk-filter.pid
	then
		kill `head -1 /var/run/dk-filter.pid`
	else
		echo " dk-filter: not running" 2>&1
	fi
	sh "${0}" wait
	rm -f /var/run/dk-filter.pid
	;;
wait)
	while ps -axw -o pid,command | egrep "^[0-9]+ %%PREFIX%%/libexec/dk-filter "
	do
		echo "please wait"
		sleep 1
	done
	;;
restart)
	"$0" stop
	"$0" start
	;;
status)
	if [ -z "$(ps -axw -o pid,command | egrep "^[0-9]+ %%PREFIX%%/libexec/dk-filter ")" ]
	then
		echo "FAILED dk-filter is not running!"
	else
		echo "OK dk-filter is running!"
	fi
	;;
*)
	echo "Usage: ${0##*/}: {start|stop|restart|status}" >&2
	exit 64
	;;
esac
OpenPOWER on IntegriCloud