mirror of
https://git.FreeBSD.org/ports.git
synced 2024-12-29 05:38:00 +00:00
cfaa301726
Noticed by: Blaz Zupan <blaz@si.FreeBSD.org> Pointy hat to: /me
38 lines
854 B
Bash
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
|