2021-08-14 21:31:02 +00:00
|
|
|
[Unit]
|
2021-08-28 11:51:11 +00:00
|
|
|
Description=Backup for Container Volume %I
|
2021-08-14 21:31:02 +00:00
|
|
|
|
|
|
|
[Service]
|
|
|
|
Type=oneshot
|
2021-08-28 18:16:29 +00:00
|
|
|
SyslogIdentifier=%N
|
2021-08-14 21:31:02 +00:00
|
|
|
ExecStartPre=/bin/install --mode 0700 --directory %S/backups/coreos-home-server/%i
|
2021-08-28 18:16:29 +00:00
|
|
|
ExecStart=/bin/podman run --replace --rm --name %p-%i --entrypoint /bin/bash \
|
2021-08-14 21:31:02 +00:00
|
|
|
--volume %i:/data:z,ro \
|
|
|
|
--volume %S/backups/coreos-home-server/%i:/backups:z \
|
2021-08-28 18:16:29 +00:00
|
|
|
docker.io/debian:stable-slim \
|
2021-08-14 21:31:02 +00:00
|
|
|
-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
|