Simple backup of maildir folder

Laura Smith n5d9xq3ti233xiyif2vp at protonmail.ch
Sun May 31 12:11:28 EEST 2020




Sent with ProtonMail Secure Email.

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Sunday, 31 May 2020 09:35, @lbutlr <kremels at kreme.com> wrote:


>
> A couple of notes on this quite useful script:
>
> My mktemp does not support -p (FreeBSD 12.1) is I had to change the script to:
>


In my scripts I tend to create a tempdir and then tempfiles within that.  It makes the cleanup routine neater, e.g. at the top of my scripts :

TEMP_DIR=$(mktemp -qd || { doLog "Failed to make temp dir !"; exit 1; })
rmTmpFiles() { rm -rf "${TEMP_DIR}"; }
createTempFile() { local MYTEMP=$(mktemp -qp "${TEMP_DIR}" || doLog "Failed to create temp file"; exit 1); echo $MYTEMP; }

Also my backup scripts have locking procedures built-in so as to avoid race conditions.


More information about the dovecot mailing list