coreos-home-server/config/common/systemd/container-volume-backup@.service
Alex Palaistras 1ff1857515 Fix name expansion for container volume backups
This was previously not expanded correctly as per Bash rules.
2021-12-26 13:41:56 +00:00

18 lines
713 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:/backups:z \
docker.io/debian:bullseye-slim -c \
'name="%i-$(date +%%w%%H)" && \
tar -cvpzf "/backups/$name.tar.gz" -C /data . && \
ln --force "/backups/$name.tar.gz" /backups/%i-latest.tar.gz'
[Install]
WantedBy=multi-user.target