瀏覽代碼

fixed bug that occured due to commenting out log-function

master
Victor Giers 1 年之前
父節點
當前提交
90f88023c7
共有 2 個文件被更改,包括 23 次插入7 次删除
  1. 8
    7
      backup_routine.sh
  2. 15
    0
      log.txt

+ 8
- 7
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

+ 15
- 0
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.

Loading…
取消
儲存