From 810fccfce2b04184403538f4fbaf03bb0b110318 Mon Sep 17 00:00:00 2001 From: Salt Date: Tue, 19 May 2020 12:14:27 -0500 Subject: [PATCH] Add log function to backup script: --- roles/terraria/templates/backup.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/roles/terraria/templates/backup.sh b/roles/terraria/templates/backup.sh index e6a6709..26af286 100644 --- a/roles/terraria/templates/backup.sh +++ b/roles/terraria/templates/backup.sh @@ -13,6 +13,12 @@ export TERRARIADIR="{{ terraria_root }}/{{ terraria_name }}" export OUTDIR="$TERRARIADIR/backups" retention=144 # 30-minute intervals, 3 days +# Helper functions +log() { + [ -z "$1" ] && return 1 + printf "$(date -Iseconds): $1\n" +} + # Sanity checks if ! [ -d "$OUTDIR" ]; then if ! mkdir "$OUTDIR"; then