container-volume-backup: Use symlink to latest file

Pointers to the latest backup are useful for restore operations, but
should be ignored in all other cases, and thus are more appropriately
handled as symbolic links.
This commit is contained in:
Alex Palaistras 2022-02-06 20:46:20 +00:00
parent 9dad5ad2c4
commit 4fc786219a
1 changed files with 1 additions and 1 deletions

View File

@ -13,7 +13,7 @@ ExecStart=/bin/podman run --replace --rm --name %p-%i --entrypoint /bin/bash \
test "$(find /data -type f -newer /backup/%i-latest.tar.gz -print -quit | wc -l)" -eq 0 && exit 0; \
name="%i-$(date +%%w%%H)" && \
tar --verbose --create --gzip --file "/backup/$name.tar.gz" --directory /data . && \
ln --force "/backup/$name.tar.gz" /backup/%i-latest.tar.gz'
cd /backup && ln --symbolic --force "$name.tar.gz" %i-latest.tar.gz'
[Install]
WantedBy=multi-user.target