From 1e665a40b77f2839761c4b4f37e1fa1bc95a548c Mon Sep 17 00:00:00 2001 From: Hyperling Date: Thu, 9 Oct 2025 07:37:14 -0700 Subject: [PATCH] Add date and hostname to backup file. Delete previous dates. --- bin/backup.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bin/backup.sh b/bin/backup.sh index d44e7a6..363b7f8 100755 --- a/bin/backup.sh +++ b/bin/backup.sh @@ -9,7 +9,9 @@ source $DIR/../source.env ## Variables ## -file="/tmp/Backup-Docker.zip" +DATE="`date "+%Y%m%d"`" +BASENAME="/tmp/Backup-Docker" +file="$BASENAME.$DATE.$HOSTNAME.zip" time="`which time`" ## Main ## @@ -17,7 +19,7 @@ time="`which time`" # Remove the last backup. if [[ -e $file ]]; then echo "`date` - Removing existing file." - rm -fv $file + rm -fv "$BASENAME"* fi echo -e "\n`date` - Take down services for a cold backup."