The script is an adapted version of the script used by the mariadb operator on kubernetes. It runs in a container. The container is created using the podman quadlet container configuration file /etc/containers/systemd/users/1000/mariadb-www-backup.container:
[Unit] Description=Backup MariaDB on VM www OnFailure=status_email_simar@%n.service [Container] Image=docker.io/mariadb:10.11 Environment=MARIADB_OPERATOR_USER=root Environment=MARIADB_OPERATOR_PASSWORD=[...] Environment=MARIADB_SERVER=192.168.1.[...] Volume=$PATH_TO_BACKUP_STORAGE:/backup Exec=/bin/bash -c "set -euo pipefail; \ echo 💾 Exporting env; \ export BACKUP_FILE=backup.$(date -u +'%%Y-%%m-%%dT%%H:%%M:%%SZ').sql.zstd; \ echo 💾 Writing target file: /backup/0-backup-target.txt; \ printf \"$${BACKUP_FILE}\" > /backup/0-backup-target.txt; \ echo 💾 Setting target file permissions; \ chmod 777 /backup/0-backup-target.txt; \ echo 💾 Taking backup: /backup/$(cat '/backup/0-backup-target.txt'); \ mariadb-dump --user=$${MARIADB_OPERATOR_USER} \ --password=$${MARIADB_OPERATOR_PASSWORD} \ --host=$${MARIADB_SERVER} --port=3306 \ --single-transaction --events --routines --all-databases \ --skip-add-locks --ignore-table=mysql.global_priv \ | zstd --no-progress -19 -T0 -f -o /backup/$(cat '/backup/0-backup-target.txt')"
/etc/systemd/users/status_email_xyz@.service
[Unit] Description=status email for %i to xyz [Service] Type=oneshot ExecStart=/usr/local/bin/systemd-email xyz@mou.servants.priv %i
/usr/local/bin/systemd-email
#!/bin/sh /usr/sbin/sendmail -t <<ERRMAIL To: $1 From: systemd <root@$(hostname --fqdn)> Subject: $2 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 $(systemctl --user status --full "$2") ERRMAIL