diff options
Diffstat (limited to 'setup-zabbix-db.sh')
-rwxr-xr-x | setup-zabbix-db.sh | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/setup-zabbix-db.sh b/setup-zabbix-db.sh new file mode 100755 index 0000000..d867076 --- /dev/null +++ b/setup-zabbix-db.sh @@ -0,0 +1,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 |