initial commit
This commit is contained in:
30
backup_routine.sh
Normal file
30
backup_routine.sh
Normal file
@@ -0,0 +1,30 @@
|
||||
#!/bin/bash
|
||||
|
||||
IFS=$'\r\n' GLOBIGNORE='*' command eval 'FILES=($(cat backup_filelist.txt))'
|
||||
|
||||
for i in "${FILES[@]}"
|
||||
do
|
||||
FILENAME=$(basename "$i")
|
||||
if [ -f "$FILENAME" ]; then
|
||||
#echo "$FILENAME exists."
|
||||
DIF=$(diff "$i" "$FILENAME")
|
||||
if [ -z "$DIF" ]
|
||||
then
|
||||
#echo "$FILENAME has not changed, skipping."
|
||||
else
|
||||
#echo "$FILENAME has changed, copying..."
|
||||
cp "$i" .
|
||||
fi
|
||||
else
|
||||
#echo "$FILENAME does not exist, copying..."
|
||||
cp "$i" .
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ `git status --porcelain` ]]; then
|
||||
#echo "Git reports changes. Perfoming next generic commit."
|
||||
git add *
|
||||
git commit -m "next commit"
|
||||
else
|
||||
#echo "Git doesn't report any changes. No new commit. Exiting."
|
||||
fi
|
||||
Reference in New Issue
Block a user