mirror of
https://github.com/deuill/coreos-home-server.git
synced 2024-09-21 13:40:45 +00:00
Alex Palaistras
4636730d32
Container volume backups will now be skipped if no changes have been made in source files against the latest backup. In addition the default timer has been changed for performing backups once a day, at 02:00, likely a time where there's less traffic on the server.
20 lines
937 B
Desktop File
20 lines
937 B
Desktop File
[Unit]
|
|
Description=Backup for Container Volume %I
|
|
|
|
[Service]
|
|
Type=oneshot
|
|
SyslogIdentifier=%N
|
|
ExecStartPre=/bin/install --mode 0700 --directory %S/backups/coreos-home-server/%i
|
|
ExecStart=/bin/podman run --replace --rm --name %p-%i --entrypoint /bin/bash \
|
|
--volume %i:/data:z,ro \
|
|
--volume %S/backups/coreos-home-server/%i:/backup:z \
|
|
docker.io/debian:bullseye-slim -c \
|
|
'test -f /backup/%i-latest.tar.gz && \
|
|
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'
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|