fix purge script

This commit is contained in:
Gnieark 2017-01-19 18:36:59 +01:00
parent 7d0dae228a
commit b8534de6e4
2 changed files with 25 additions and 21 deletions

View File

@ -1,6 +1,8 @@
# Trash-email-alias # Trash-email-alias
A dovecot sieve 's script and configuration to generate a temporary random alias. A dovecot sieve 's script and configuration to generate a temporary random alias.
Read more on my blog (french) https://blog-du-grouik.tinad.fr/post/2017/01/18/Alias-mail-temporaire
# Usage # Usage
Just send an email to the configured em-mail generator. It will respond you and indicate what is your alias. Just send an email to the configured em-mail generator. It will respond you and indicate what is your alias.
You can test it by sending a mail to [ getalias Arobaze tinad.fr ]. You can test it by sending a mail to [ getalias Arobaze tinad.fr ].
@ -47,6 +49,8 @@ On /etc/dovecot/dovecot.conf my plugin section looks like:
(...) (...)
} }
Copy this repo's files where they're needed ;)
Change your mysql credentials on cron/purge.sh and execute/genalias.sh Change your mysql credentials on cron/purge.sh and execute/genalias.sh
In my case, this files are owned by the unix user "dovecot". In my case, this files are owned by the unix user "dovecot".

View File

@ -8,15 +8,15 @@ MYSQLUSER="postfix"
MYSQLPWD="******" MYSQLPWD="******"
LOGGERPATH="/usr/bin/logger" LOGGERPATH="/usr/bin/logger"
LOGFILE="/var/log/genalias.log" LOGFILE="/var/log/genalias.log"
DOMAIN="tinad.fr"
TTL="3600" TTL="3600"
$MYSQLPATH -u $MYSQLUSER -p$MYSQLPWD $MYSQLDB<< EOF $MYSQLPATH -u $MYSQLUSER -p$MYSQLPWD $MYSQLDB<< EOF
UPDATE alias UPDATE alias
SET active='0' SET active='0'
WHERE DOMAIN='tinad.fr' WHERE DOMAIN='$DOMAIN'
AND active = '1' AND active = '1'
AND created < (UNIX_TIMESTAMP() - $TTL) AND modified > (UNIX_TIMESTAMP() - $TTL)
AND temporary='1'; AND temporary='1';
EOF EOF