[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 . && \ cd /backup && ln --symbolic --force "$name.tar.gz" %i-latest.tar.gz' [Install] WantedBy=multi-user.target