Update how script handles/sets up logs

release/full-rewrite
capntack 8 months ago
parent 79d1d4b500
commit 55a6c90fb5

1
.gitignore vendored

@ -1,4 +1,5 @@
*.log *.log
logs
.resticPassword .resticPassword
backups.sh backups.sh
restic.sh restic.sh

@ -18,6 +18,7 @@ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
############################ ############################
# Setup for logging # Setup for logging
mkdir -p "${SCRIPT_DIR}"/logs
exec 3<&1 4<&2 exec 3<&1 4<&2
trap "exec 2<&4 1<&3" 0 1 2 3 trap "exec 2<&4 1<&3" 0 1 2 3
exec > >(tee >(ts "%Y-%m-%d_%H:%M:%S" > "${BACKUP_LOG}")) 2>&1 exec > >(tee >(ts "%Y-%m-%d_%H:%M:%S" > "${BACKUP_LOG}")) 2>&1

Loading…
Cancel
Save