This is a simple database dump script for a Podman PostgreSQL container.
Create a service, replace myapp with your container-name (e.g. hub-pgsql):
$ systemctl --user edit container-dump --full --force
[Unit]
Description=Run pg_dump on PostgreSQL container
Requires=myapp-pgsql.service
After=myapp-pgsql.service
[Service]
Type=oneshot
ExecStart=~/.local/bin/backup-container.sh
[Install]
WantedBy=multi-user.targetTest the service:
$ systemctl --user start container-dumpTo create the systemd timer:
$ systemctl --user edit container-dump.timer --full --force
[Unit]
Description=Run pg_dump on PostgreSQL container daily
[Timer]
OnCalendar=*-*-* 4:00:00
Persistent=true
[Install]
WantedBy=timers.targetTo enable the systemd timer:
$ systemctl --user enable container-dump.timer --now