12345678910111213141516171819202122232425262728293031 |
- #!/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." >> log.txt
- DIF=$(diff "$i" "$FILENAME")
- if [ -z "$DIF" ]
- then
- echo "$FILENAME has not changed, skipping." >> log.txt
- else
- echo "$FILENAME has changed, copying..." >> log.txt
- cp "$i" .
- fi
- else
- 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." >> log.txt
- git add *
- git commit -m "next commit"
- else
- echo "Git doesn't report any changes. No new commit. Exiting." >> log.txt
-
- fi
|