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