mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2024-11-22 20:51:07 +01:00
Renamed variables
This commit is contained in:
parent
2d82a1a77f
commit
f4b8e2b8dd
@ -9,28 +9,28 @@ source_machine_id="$( (ssh "$source_host" sha256sum /etc/machine-id) | head -c 6
|
|||||||
source_path="/Backups/$source_machine_id/"
|
source_path="/Backups/$source_machine_id/"
|
||||||
directories="$(ssh "$source_host" find "$source_path" -maxdepth 1 -type d)" || exit 1
|
directories="$(ssh "$source_host" find "$source_path" -maxdepth 1 -type d)" || exit 1
|
||||||
|
|
||||||
for folder in $directories; do
|
for backup_type_dir in $directories; do
|
||||||
if [ "$folder" != "$source_path" ]; then
|
if [ "$backup_type_dir" != "$source_path" ]; then
|
||||||
# this folder is neccessary to make restricted rsync possible:
|
# this folder is neccessary to make restricted rsync possible:
|
||||||
diff_current="$folder/diffs/current/"
|
current_version="$backup_type_dir/versions/current/"
|
||||||
# this is the folder where the diffs will be copied to:
|
# this is the folder where the versions will be copied to:
|
||||||
diff_store="$folder/diffs/$(date '+%Y%m%d%H%M%S')/"
|
diff_store="$backup_type_dir/versions/$(date '+%Y%m%d%H%M%S')/"
|
||||||
# this is the folder which contains the actual backup:
|
# this is the folder which contains the actual backup:
|
||||||
latest_path="$folder/latest/"
|
latest_path="$backup_type_dir/latest/"
|
||||||
# source path of the backup files:
|
# source path of the backup files:
|
||||||
remote_source_path="$source_host:$latest_path"
|
remote_source_path="$source_host:$latest_path"
|
||||||
# file in which the logs will be saved:
|
# file in which the logs will be saved:
|
||||||
log_path="$folder/log.txt"
|
log_path="$backup_type_dir/log.txt"
|
||||||
|
|
||||||
# create working folders:
|
# create working folders:
|
||||||
mkdir -vp "$latest_path"
|
mkdir -vp "$latest_path"
|
||||||
mkdir -vp "$diff_store"
|
mkdir -vp "$diff_store"
|
||||||
rm -vr "$diff_current"
|
rm -vr "$current_version"
|
||||||
mkdir -vp "$diff_current"
|
mkdir -vp "$current_version"
|
||||||
|
|
||||||
# do backup:
|
# do backup:
|
||||||
rsync -abP --delete --delete-excluded --rsync-path="sudo rsync" --log-file="$log_path" --backup-dir="$diff_current" "$remote_source_path" "$latest_path" || ((errors+=1));
|
rsync -abP --delete --delete-excluded --rsync-path="sudo rsync" --log-file="$log_path" --backup-dir="$current_version" "$remote_source_path" "$latest_path" || ((errors+=1));
|
||||||
mv -v "$diff_current"* "$diff_store"
|
mv -v "$current_version"* "$diff_store"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
exit $errors;
|
exit $errors;
|
||||||
|
Loading…
Reference in New Issue
Block a user