Commit c449215b authored by Claudemir Todo Bom's avatar Claudemir Todo Bom

* use doveadm to clean trash and junk folders

parent 1c79c7fb
Pipeline #264 passed with stage
in 1 minute and 22 seconds
#!/bin/bash
# delete 30 day old monitoring mails
# delete 31 day old monitoring mails
cat /etc/default/wwmail | sed -e 's/: /=/g' > /tmp/wwmail.$$.tmp
source /tmp/wwmail.$$.tmp
rm /tmp/wwmail.$$.tmp
for f in $(echo "select maildir from users,monitoring where users.address=monitoring.address" | mysql -h ${WW_ISP_HOST} -p${WW_ISP_PASS} -r -N -u${WW_ISP_USER} ${WW_ISP_DB}) ; do
/usr/bin/find "$f" -regex '.*/\.monitor\..*\/\(cur\|new\)/.*' -type f -mtime +30 -delete &> /tmp/cleanmonitoring-$(basename "$f").log
done
# or -exec rm '{}' \; instead of -delete
/usr/bin/doveadm expunge -A mailbox monitor/* savedbefore 31d &> /tmp/cleanmonitoring.log
#!/bin/bash
# delete 30 day old trash and deleted messages
# delete 31 day old trash and deleted messages
/usr/bin/find /var/spool/maildir/ -regex '.*/\(\.\([Jj]unk\(\ .*\)?\|[Ss]pam\|[Tt]rash\|[Ll]ixo\(\ .*\)?\|[Ii]tens\ [Ee]xclu.*\)\(/.*\)?\/\(cur\|new\)/.*\|.*\/cur/.*\:[0-9]+,.*T.*\)' -type f -mtime +30 -delete &> /tmp/cleantrash.log
# or -exec rm '{}' \; instead of -delete
/usr/bin/doveadm expunge -A \( mailbox Trash OR mailbox Junk OR mailbox Spam \) savedbefore 31d &> /tmp/cleantrash.log
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment