#!/bin/bash

set -e

kinit -k "daemon/$(hostname -f)"
aklog sipb

filename="/mit/xvm/backups/db/prod/$(date +%Y-%m-%d-%H-%M.sql.gz)"

/usr/bin/pg_dump -U "$(invirt-getconf db.user)" \
                 -h "$(invirt-getconf db.host)" \
                 "$(invirt-getconf db.dbname)" | gzip - >"$filename"
