From 90f88023c717f54b669f858dcb23bbc2d393c4ed Mon Sep 17 00:00:00 2001 From: Victor Giers Date: Fri, 27 May 2022 17:06:46 +0200 Subject: [PATCH] fixed bug that occured due to commenting out log-function --- backup_routine.sh | 15 ++++++++------- log.txt | 15 +++++++++++++++ 2 files changed, 23 insertions(+), 7 deletions(-) create mode 100644 log.txt diff --git a/backup_routine.sh b/backup_routine.sh index 762091d..db0a762 100644 --- a/backup_routine.sh +++ b/backup_routine.sh @@ -1,30 +1,31 @@ #!/bin/bash IFS=$'\r\n' GLOBIGNORE='*' command eval 'FILES=($(cat backup_filelist.txt))' - +echo `date` >> log.txt for i in "${FILES[@]}" do FILENAME=$(basename "$i") if [ -f "$FILENAME" ]; then - #echo "$FILENAME exists." + #echo "$FILENAME exists." >> log.txt DIF=$(diff "$i" "$FILENAME") if [ -z "$DIF" ] then - #echo "$FILENAME has not changed, skipping." + echo "$FILENAME has not changed, skipping." >> log.txt else - #echo "$FILENAME has changed, copying..." + echo "$FILENAME has changed, copying..." >> log.txt cp "$i" . fi else - #echo "$FILENAME does not exist, copying..." + echo "$FILENAME is a new file, copying..." >> log.txt cp "$i" . fi done if [[ `git status --porcelain` ]]; then - #echo "Git reports changes. Perfoming next generic commit." + echo "Git reports changes. Perfoming next generic commit." >> log.txt git add * git commit -m "next commit" else - #echo "Git doesn't report any changes. No new commit. Exiting." + echo "Git doesn't report any changes. No new commit. Exiting." >> log.txt + fi diff --git a/log.txt b/log.txt new file mode 100644 index 0000000..1529eb5 --- /dev/null +++ b/log.txt @@ -0,0 +1,15 @@ +Bestand.xlsx exists. +Bestand.xlsx has not changed, skipping. +ToDo.xlsx exists. +ToDo.xlsx has not changed, skipping. +Git doesn't report any changes. No new commit. Exiting. +Fr 27 Mai 2022 17:01:20 CEST +Bestand.xlsx exists. +Bestand.xlsx has not changed, skipping. +ToDo.xlsx exists. +ToDo.xlsx has not changed, skipping. +Git doesn't report any changes. No new commit. Exiting. +Fr 27 Mai 2022 17:02:19 CEST +Bestand.xlsx has not changed, skipping. +ToDo.xlsx has not changed, skipping. +Git doesn't report any changes. No new commit. Exiting.