mirror of
https://github.com/kevinveenbirkenbach/docker-volume-backup.git
synced 2024-11-22 16:31:02 +01:00
Compare commits
2 Commits
d8471e5b4b
...
02449cb501
Author | SHA1 | Date | |
---|---|---|---|
02449cb501 | |||
4290464986 |
@ -41,25 +41,16 @@ repository_name = os.path.basename(dirname)
|
|||||||
machine_id = bash("sha256sum /etc/machine-id")[0][0:64]
|
machine_id = bash("sha256sum /etc/machine-id")[0][0:64]
|
||||||
# Folder in which all Backups are stored
|
# Folder in which all Backups are stored
|
||||||
backups_dir = '/Backups/'
|
backups_dir = '/Backups/'
|
||||||
# Folder in which docker volume backups are stored
|
# Folder in which the versions off docker volume backups are stored
|
||||||
backup_type_dir = backups_dir + machine_id + "/" + repository_name + "/"
|
versions_dir = backups_dir + machine_id + "/" + repository_name + "/"
|
||||||
# Folder containing all versions
|
|
||||||
versions_dir = backup_type_dir + "versions/"
|
|
||||||
# Time when the backup started
|
# Time when the backup started
|
||||||
backup_time = datetime.now().strftime("%Y%m%d%H%M%S")
|
backup_time = datetime.now().strftime("%Y%m%d%H%M%S")
|
||||||
# Folder containing the current version
|
# Folder containing the current version
|
||||||
version_dir = versions_dir + backup_time + "/"
|
version_dir = versions_dir + backup_time + "/"
|
||||||
# Define latest path
|
|
||||||
latest_link = backup_type_dir + "latest/"
|
|
||||||
# Create folder to store version in
|
# Create folder to store version in
|
||||||
pathlib.Path(version_dir).mkdir(parents=True, exist_ok=True)
|
pathlib.Path(version_dir).mkdir(parents=True, exist_ok=True)
|
||||||
|
|
||||||
if pathlib.Path(latest_link).is_symlink():
|
|
||||||
print("Unlink " + latest_link + "...")
|
|
||||||
pathlib.Path(latest_link).unlink()
|
|
||||||
# Link latest to current version
|
|
||||||
pathlib.Path(latest_link).symlink_to(version_dir)
|
|
||||||
|
|
||||||
print('start volume backups...')
|
print('start volume backups...')
|
||||||
print('load connection data...')
|
print('load connection data...')
|
||||||
databases = pandas.read_csv(dirname + "/databases.csv", sep=";")
|
databases = pandas.read_csv(dirname + "/databases.csv", sep=";")
|
||||||
|
@ -5,7 +5,7 @@ version="$3" # version to backup
|
|||||||
container="$4" # optional
|
container="$4" # optional
|
||||||
mysql_root_password="$5" # optional
|
mysql_root_password="$5" # optional
|
||||||
database="$6" # optional
|
database="$6" # optional
|
||||||
backup_folder="Backups/$backup_hash/docker-volume-backup/versions/$version/$volume_name"
|
backup_folder="Backups/$backup_hash/docker-volume-backup/$version/$volume_name"
|
||||||
backup_files="/$backup_folder/files"
|
backup_files="/$backup_folder/files"
|
||||||
backup_sql="/$backup_folder/sql/backup.sql"
|
backup_sql="/$backup_folder/sql/backup.sql"
|
||||||
echo "Inspect volume $volume_name"
|
echo "Inspect volume $volume_name"
|
||||||
|
Loading…
Reference in New Issue
Block a user