Find the alias file name from the postfix configuration. From our anonymous

user.
This commit is contained in:
christos 2006-09-05 22:10:51 +00:00
parent 24f4ed9338
commit e32e513967
1 changed files with 14 additions and 11 deletions

View File

@ -1,6 +1,6 @@
#!/bin/sh
#
# $NetBSD: postfix,v 1.10 2006/06/18 14:05:34 christos Exp $
# $NetBSD: postfix,v 1.11 2006/09/05 22:10:51 christos Exp $
#
# PROVIDE: mail
@ -21,6 +21,7 @@ reload_cmd="postfix_op"
extra_commands="reload"
spooletcdir="/var/spool/${name}/etc"
required_dirs=$spooletcdir
newaliases="/usr/bin/newaliases"
postfix_precmd()
{
@ -37,18 +38,20 @@ postfix_precmd()
fi
done
# check modifications on /etc/mail/aliases
if [ -f "/etc/mail/aliases.db" ]; then
if [ ! "/etc/mail/aliases" -ot "/etc/mail/aliases.db" ]; then
for f in $(postconf -h alias_database); do
dbfile="${f#*:}"
if [ -f "${dbfile}.db" ]; then
if [ ! "${dbfile}" -ot "${dbfile}.db" ]; then
echo \
"${name}: ${dbfile} newer than ${dbfile}.db, running $newaliases"
$newaliases
fi
else
echo \
"${name}: /etc/mail/aliases newer than /etc/mail/aliases.db, regenerating"
/usr/bin/newaliases
"${name}: ${dbfile}.db not present, running $newaliases"
$newaliases
fi
else
echo \
"${name}: /etc/mail/aliases.db not present, generating"
/usr/bin/newaliases
fi
done
}
postfix_op()