X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=bacula%2Fsrc%2Fcats%2Fmake_catalog_backup.in;h=6c20a8ebd6287848583509c69225025c6ab4e2fc;hb=f8f848fdb5aace95292d905dc60fe0de45521859;hp=f2327dee593b8a8acae50ea45179843cbc401f0c;hpb=c45f37e0b262f63e0e4c9afb0d7683431654bcd1;p=bacula%2Fbacula diff --git a/bacula/src/cats/make_catalog_backup.in b/bacula/src/cats/make_catalog_backup.in index f2327dee59..6c20a8ebd6 100755 --- a/bacula/src/cats/make_catalog_backup.in +++ b/bacula/src/cats/make_catalog_backup.in @@ -1,17 +1,38 @@ #!/bin/sh # # This script dumps your Bacula catalog in ASCII format -# It works for either MySQL or SQLite +# It works for MySQL, SQLite, and PostgreSQL +# +# $1 is the name of the database to be backed up and the name +# of the output file (default = bacula). +# $2 is the user name with which to access the database +# (default = bacula). +# $3 is the password with which to access the database or "" if no password +# (default "") +# # cd @working_dir@ rm -f bacula.sql if test xsqlite = x@DB_NAME@ ; then - echo ".dump" | @SQL_BINDIR@/sqlite bacula.db >bacula.sql + echo ".dump" | @SQL_BINDIR@/sqlite $1.db >$1.sql else if test xmysql = x@DB_NAME@ ; then - @SQL_BINDIR@/mysqldump $* -f --opt bacula >bacula.sql - else - @SQL_BINDIR@/pg_dump $* bacula >bacula.sql + if test $# -gt 2; then + MYSQLPASSWORD=" --password=$3" + else + MYSQLPASSWORD="" + fi + @SQL_BINDIR@/mysqldump -u $2$MYSQLPASSWORD -f --opt $1 >$1.sql + else + if test xpostgresql = x@DB_NAME@ ; then + if test $# -gt 2; then + PGPASSWORD=$3 + export PGPASSWORD + fi + exec @SQL_BINDIR@/pg_dump -U $2 $1 >$1.sql + else + echo ".dump" | @SQL_BINDIR@/sqlite3 $1.db >$1.sql + fi fi fi # @@ -28,5 +49,6 @@ fi # To read back a PostgreSQL database use: # cd @working_dir@ # dropdb bacula +# createdb bacula # psql bacula