#!/bin/zsh set -eax podman compose up -d postgres for f in /usr/share/zabbix/database/postgresql/schema.sql /usr/share/zabbix/database/postgresql/images.sql /usr/share/zabbix/database/postgresql/data.sql; do f2="$(basename "$f")" podman compose run -it --rm zabbix cat "$f" > "tmp.$f2" || (rm "tmp.$f2" && exit 1) (cat "tmp.$f2" | podman compose exec -T postgres psql -U zabbix -f /proc/self/fd/0) || (rm "tmp.$f2" && exit 1) rm "tmp.$f2" done