pkgsrc/security/amavisd-new/files/amavisd.sh
jlam 1403a3a8be Reimport mail/amavisd-new as security/amavisd-new.
amavisd-new is an interface between message transfer agent (MTA) and
one or more content checkers, e.g. virus scanners, SpamAssassin, etc.
It is a performance-enhanced and feature-enriched version of amavisd
(which in turn is a daemonized version of AMaViS or amavis-perl).

amavisd-new is normally positioned at or near a central mailer, not
necessarily where user's mailboxes and final delivery takes place.  If
you are looking for fully per-user configurable and/or low-message-rate
solution to be placed at the final stage of mail delivery (e.g. called
from procmail), there may be other solutions more appropriate for your
needs.

Package created and maintained by Julian Dunn in pkgsrc-wip.
2004-08-06 15:05:53 +00:00

77 lines
1.9 KiB
Bash

#!@RCD_SCRIPTS_SHELL@
#
# $NetBSD: amavisd.sh,v 1.1.1.1 2004/08/06 15:05:54 jlam Exp $
#
# PROVIDE: amavisd
# REQUIRE: DAEMON
# BEFORE: mail
#
#
# You will need to set some variables in /etc/rc.conf to start amavisd:
#
# amavisd=YES
#
# The following variables are optional:
#
# amavisd_user="@AMAVIS_USER@" # user to run amavisd as
# amavisd_group="@AMAVIS_GROUP@" # ${amavisd_user}'s group
# amavisd_dirs="@AMAVIS_DIR@" # directories that should be created
# # before starting amavisd
if [ -f /etc/rc.subr ]; then
. /etc/rc.subr
fi
name="amavisd"
rcvar=$name
command="@PREFIX@/sbin/${name}"
command_interpreter="@PERL5@"
pidfile="@AMAVIS_DIR@/amavisd.pid"
required_files="@PKG_SYSCONFDIR@/${name}.conf"
: ${amavisd_user="@AMAVIS_USER@"}
: ${amavisd_group="@AMAVIS_GROUP@"}
: ${amavisd_dirs="@AMAVIS_DIR@ @AMAVIS_DIR@/db @AMAVIS_DIR@/tmp @AMAVIS_QUARANTINE@"}
start_precmd="amavisd_prestart"
stop_cmd="amavisd_stop"
amavisd_prestart()
{
@RM@ -f @AMAVIS_DIR@/amavisd.sock
for dir in ${amavisd_dirs}; do
@MKDIR@ $dir
@CHOWN@ ${amavisd_user}:${amavisd_group} $dir
@CHMOD@ 0750 $dir
done
}
# Net::Server breaks rc.subr's techniques for detecting whether the
# process running at a certain PID is actually the process we wish to
# stop. Just unconditionally send SIGTERM to the PID instead.
#
amavisd_stop()
{
@ECHO@ "Stopping ${name}."
if [ -f ${pidfile} ]; then
pid=`@HEAD@ -1 ${pidfile}`
doit="@SU@ -m ${amavisd_user} -c \"kill ${pid}\""
if ! eval $doit && [ -z "$rc_force" ]; then
return 1
fi
wait_for_pids $pid
fi
@RM@ -f ${pidfile}
for dir in ${amavisd_dirs}; do
@RMDIR@ -p $dir 2>/dev/null || @TRUE@
done
}
if [ -f /etc/rc.subr -a -f /etc/rc.conf \
-a -d /etc/rc.d -a -f /etc/rc.d/DAEMON ]; then
load_rc_config $name
run_rc_command "$1"
else
@ECHO@ -n " ${name}"
eval ${start_precmd}
${command} ${amavisd_flags} ${command_args}
fi