1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-29 05:38:00 +00:00
freebsd-ports/security/amavisd-new/files/amavisd.sh.tmpl
Dmitry Sivachenko cfaa301726 Fix broken files (duplicate contents).
Noticed by:	Blaz Zupan <blaz@si.FreeBSD.org>
Pointy hat to:	/me
2003-01-04 10:59:25 +00:00

38 lines
854 B
Bash

#!/bin/sh
if ! PREFIX=$(expr $0 : "\(/.*\)/etc/rc\.d/$(basename $0)\$"); then
echo "$0: Cannot determine the PREFIX" >&2
exit 1
fi
DIR=%%AMAVISDIR%%
PIDFILE=$DIR/amavisd.pid
CONFIGFILE=${PREFIX}/etc/amavisd.conf
SOCKFILES=$DIR/amavis*.sock
MILTERFLAG=$DIR/use.milter
case "$1" in
start)
if [ -e ${PREFIX}/etc/amavisd.conf ]; then
rm -rf ${SOCKFILES}
if [ -e $MILTERFLAG ]; then
su %%AMAVISUSER%% -c "${PREFIX}/sbin/amavis-milter -D -p $DIR/amavis-milter.sock"
fi
su %%AMAVISUSER%% -c "${PREFIX}/sbin/amavisd -c ${CONFIGFILE} > /dev/null 2>&1" && echo -n ' amavisd'
fi
;;
stop)
if [ -e $MILTERFLAG ]; then
killall -u %%AMAVISUSER%% amavis-milter >/dev/null 2>&1
fi
if [ -e $PIDFILE ]; then
su %%AMAVISUSER%% -c "kill `cat $PIDFILE`" && echo -n ' amavisd'
fi
;;
*)
echo "Usage: `basename $0` {start|stop}" >&2
;;
esac
exit 0