Sent with ProtonMail Secure Email.

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Sunday, 31 May 2020 09:35, @lbutlr <krem...@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.

Reply via email to