Write out the list of running VMs to AFS as well as the database backup
[invirt/packages/xvm-db-backup.git] / xvm-db-backup
1 #!/bin/bash
2
3 set -e
4
5 kinit -k "daemon/$(hostname -f)"
6 aklog sipb
7
8 db_filename="/mit/xvm/backups/db/prod/$(date +%Y-%m-%d-%H-%M.sql.gz)"
9
10 /usr/bin/pg_dump -U "$(invirt-getconf db.user)" \
11                  -h "$(invirt-getconf db.host)" \
12                  "$(invirt-getconf db.dbname)" | gzip - >"$db_filename"
13
14 running_filename="/mit/xvm/log/running/prod/$(date +%Y-%m-%d-%H-%M.gz)"
15
16 remctl "$(invirt-getconf remote.hostname)" web listvms | gzip - >"$running_filename"