From 55a6c90fb53260713cc03cea1cc87940fe6baf0f Mon Sep 17 00:00:00 2001 From: capntack Date: Sat, 23 Mar 2024 01:29:39 -0500 Subject: [PATCH] Update how script handles/sets up logs --- .gitignore | 1 + logs/logFilesGoHere | 0 templates/backupsTemplate.sh | 1 + 3 files changed, 2 insertions(+) delete mode 100644 logs/logFilesGoHere diff --git a/.gitignore b/.gitignore index dae8f04..fb14dfa 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ *.log +logs .resticPassword backups.sh restic.sh diff --git a/logs/logFilesGoHere b/logs/logFilesGoHere deleted file mode 100644 index e69de29..0000000 diff --git a/templates/backupsTemplate.sh b/templates/backupsTemplate.sh index dc61ecd..6650c03 100644 --- a/templates/backupsTemplate.sh +++ b/templates/backupsTemplate.sh @@ -18,6 +18,7 @@ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) ############################ # Setup for logging +mkdir -p "${SCRIPT_DIR}"/logs exec 3<&1 4<&2 trap "exec 2<&4 1<&3" 0 1 2 3 exec > >(tee >(ts "%Y-%m-%d_%H:%M:%S" > "${BACKUP_LOG}")) 2>&1