summaryrefslogtreecommitdiffstats
path: root/setup-zabbix-db.sh
blob: d8670769559289e70dcc3e485eea0c8e838d17a0 (plain) (blame)
1
2
3
4
5
6
7
8
9
#!/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