diff --git a/docs/u_e-dovecot-mail-crypt.md b/docs/u_e-dovecot-mail-crypt.md index 6850ed7d7..d211df44b 100644 --- a/docs/u_e-dovecot-mail-crypt.md +++ b/docs/u_e-dovecot-mail-crypt.md @@ -10,9 +10,13 @@ find /var/vmail/ -type f -regextype egrep -regex '.*S=.*W=.*' | while read -r fi if [[ $(head -c7 "$file") == "CRYPTED" ]]; then doveadm fs get crypt private_key_path=/mail_crypt/ecprivkey.pem:public_key_path=/mail_crypt/ecpubkey.pem:posix:prefix=/ \ "$file" > "/tmp/$(basename "$file")" - chmod 600 "/tmp/$(basename "$file")" - chown 5000:5000 "/tmp/$(basename "$file")" - mv "/tmp/$(basename "$file")" "$file" + if [[ -s "/tmp/$(basename "$file")" ]]; then + chmod 600 "/tmp/$(basename "$file")" + chown 5000:5000 "/tmp/$(basename "$file")" + mv "/tmp/$(basename "$file")" "$file" + else + rm "/tmp/$(basename "$file")" + fi fi done