backup dir 

    Define a backup dir:

    BACKUP_DIR="/opt/backup/backup-$(date +%Y-%m-%d_%H-%M)"
    

    Take the backup: 

    mariabackup --backup --parallel=2 --safe-slave-backup --target-dir="$BACKUP_DIR"
    

    prepare 

    Not required but nice to have since you can save work and ensure backup can be restored without any problems and faster

    mariabackup --prepare --target-dir="$BACKUP_DIR"
    

    compress 

    tar -cf -"${BACKUP_DIR##*/}" | zstd > "$BACKUP_DIR.tar.zst"