3 # This script dumps your Bacula catalog in ASCII format
4 # It works for MySQL, SQLite, and PostgreSQL
6 # $1 is the name of the database to be backed up and the name
7 # of the output file (default = bacula).
8 # $2 is the user name with which to access the database
10 # $3 is the password with which to access the database or "" if no password
12 # $4 is the host on which the database is located
20 if test xsqlite = x@DB_TYPE@ ; then
21 echo ".dump" | ${BINDIR}/sqlite $1.db >$1.sql
23 if test xmysql = x@DB_TYPE@ ; then
24 if test $# -gt 2; then
25 MYSQLPASSWORD=" --password=$3"
29 if test $# -gt 3; then
30 MYSQLHOST=" --host=$4"
34 ${BINDIR}/mysqldump -u $2$MYSQLPASSWORD$MYSQLHOST -f --opt $1 >$1.sql
36 if test xpostgresql = x@DB_TYPE@ ; then
37 if test $# -gt 2; then
41 if test $# -gt 3; then
46 exec ${BINDIR}/pg_dump -c $PGHOST -U $2 $1 >$1.sql
48 echo ".dump" | ${BINDIR}/sqlite3 $1.db >$1.sql
53 # To read back a MySQL database use:
55 # rm -f ${BINDIR}/../var/bacula/*
58 # To read back a SQLite database use:
61 # sqlite bacula.db <bacula.sql
63 # To read back a PostgreSQL database use:
67 # psql bacula <bacula.sql