27 wiersze
675 B
Python
27 wiersze
675 B
Python
![]() |
from python_on_whales import docker
|
||
|
import datetime
|
||
|
import sys
|
||
|
import pathlib
|
||
|
|
||
|
|
||
|
now = "{date:%Y%m%d-%H%M%S}".format( date=datetime.datetime.now() )
|
||
|
|
||
|
source_volume = "friendica_db"
|
||
|
archive_filename = source_volume + "-" + now
|
||
|
archive_bind = pathlib.Path().resolve()
|
||
|
archive_path = str(archive_bind) + "/" + archive_filename
|
||
|
|
||
|
image = "loomchild/volume-backup"
|
||
|
command = ["backup",
|
||
|
"-c", "gz",
|
||
|
archive_filename]
|
||
|
volumes = [ (source_volume,"/volume"),
|
||
|
(archive_bind, "/backup") ]
|
||
|
|
||
|
print("Archive volume: ", source_volume, " to file: ", archive_path)
|
||
|
|
||
|
out=docker.run(image=image,
|
||
|
command=command,
|
||
|
volumes=volumes)
|
||
|
|