scripts/mail/migration3_cleanup.sh

17 lines
828 B
Bash
Raw Normal View History

#!/usr/bin/env bash
# After running Migration 3 (https://nixos-mailserver.readthedocs.io/en/latest/migrations.html#dovecot-mail-directory-migration)
# For some reason dovecot was putting items into /var/vmail/ldap/$USERNAME@skynet.ie instead of /var/vmail/skynet.ie/$USERNAME
# Whats more it was expecting to see items there so email clients were erroring out (seeing empty inboxes).
# This could be due to the extra commits we have on top of the main nixos mailserver
# This might be the case since migration 2 mentions teh /var/vmail/ldap folder as not being desired
for f in *; do
if [ -d "$f" ]; then
echo "$f"
mkdir -p "/var/vmail/ldap/$f@skynet.ie/"
# hardlink "copy", can delete the original folder afterwards
cp -rlp /var/vmail/skynet.ie/$f/* "/var/vmail/ldap/$f@skynet.ie"
fi
done