coreos-home-server/config/common/systemd/container-volume-backup@.service
Alex Palaistras 16ddc3ab79 Use 'bullseye-slim' image for volume backup
This is more likely to be available when these services are called, and
does not need to be pulled opportunistically.
2021-09-18 19:48:56 +01:00

18 lines
724 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 'env 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