mirror of
https://github.com/FAUSheppy/athq-vm-management
synced 2025-12-09 06:58:32 +01:00
feat: type in backup script
This commit is contained in:
@@ -102,7 +102,7 @@ def createBackupScriptStructure(backupList, baseDomain=""):
|
|||||||
os.chmod(os.path.join(backupPath, scriptName), 0o700)
|
os.chmod(os.path.join(backupPath, scriptName), 0o700)
|
||||||
|
|
||||||
# write filter #
|
# write filter #
|
||||||
filterName = "rsync-filter-{}.txt".format(hostnameBase)
|
filterName = "rsync-filter-{}-.txt".format(hostnameBase)
|
||||||
with open(os.path.join(backupPath, filterName), "w") as f:
|
with open(os.path.join(backupPath, filterName), "w") as f:
|
||||||
f.write(rsyncFilterAll)
|
f.write(rsyncFilterAll)
|
||||||
|
|
||||||
@@ -113,7 +113,7 @@ def createBackupScriptStructure(backupList, baseDomain=""):
|
|||||||
( "minimal" , rsyncFilterMinimal )
|
( "minimal" , rsyncFilterMinimal )
|
||||||
]
|
]
|
||||||
for filterType, render in alternativeRsyncFilters:
|
for filterType, render in alternativeRsyncFilters:
|
||||||
filterType = "rsync-filter-{}-{}.txt".format(hostnameBase, filterType)
|
filterName = "rsync-filter-{}-{}.txt".format(hostnameBase, filterType)
|
||||||
with open(os.path.join(backupPath, filterName), "w") as f:
|
with open(os.path.join(backupPath, filterName), "w") as f:
|
||||||
f.write(render)
|
f.write(render)
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,16 @@ set -eu
|
|||||||
mkdir -p {{ hostname_base }}
|
mkdir -p {{ hostname_base }}
|
||||||
cd {{ hostname_base }}
|
cd {{ hostname_base }}
|
||||||
|
|
||||||
|
TYPE=""
|
||||||
|
if [ -z "$1" ]; then
|
||||||
|
TYPE=$1
|
||||||
|
fi
|
||||||
|
|
||||||
|
TEST=$(python -c "int('$TYPE' in ['size_changed', 'no_high_data', 'minimal'])^1")
|
||||||
|
if [ $TEST -ne 0 ]; then
|
||||||
|
echo Bad Filter Option $1
|
||||||
|
fi
|
||||||
|
|
||||||
dest=./
|
dest=./
|
||||||
for x in backup-*; do
|
for x in backup-*; do
|
||||||
test -d "$x" || continue
|
test -d "$x" || continue
|
||||||
@@ -20,7 +30,7 @@ rsync \
|
|||||||
--archive --acls --xattrs --hard-links --sparse --numeric-ids \
|
--archive --acls --xattrs --hard-links --sparse --numeric-ids \
|
||||||
--one-file-system \
|
--one-file-system \
|
||||||
--link-dest="$dest" \
|
--link-dest="$dest" \
|
||||||
--filter="merge ../rsync-filter-{{ hostname_base }}.txt" \
|
--filter="merge ../rsync-filter-{{ hostname_base }}-${TYPE}.txt" \
|
||||||
root@{{ hostname }}:/ \
|
root@{{ hostname }}:/ \
|
||||||
"$target_tmp"
|
"$target_tmp"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user