]> git.sur5r.net Git - bacula/bacula/blob - bacula/src/cats/make_catalog_backup.in
- Make default mandir /usr/share/man
[bacula/bacula] / bacula / src / cats / make_catalog_backup.in
1 #!/bin/sh
2 #
3 # This script dumps your Bacula catalog in ASCII format
4 # It works for MySQL, SQLite, and PostgreSQL
5 #
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
9 #     (default = bacula).
10 #
11 #
12 cd @working_dir@
13 rm -f bacula.sql
14 if test xsqlite = x@DB_NAME@ ; then
15   echo ".dump" | @SQL_BINDIR@/sqlite $1.db >$1.sql
16 else
17   if test xmysql = x@DB_NAME@ ; then
18     @SQL_BINDIR@/mysqldump -u $2 -f --opt $1 >$1.sql
19   else
20     @SQL_BINDIR@/pg_dump -U $2 $1 >$1.sql
21   fi
22 fi
23 #
24 #  To read back a MySQL database use: 
25 #     cd @working_dir@
26 #     rm -f @SQL_BINDIR@/../var/bacula/*
27 #     mysql bacula <bacula.sql
28 #
29 #  To read back a SQLite database use:
30 #     cd @working_dir@
31 #     rm -f bacula.db
32 #     sqlite bacula.db <bacula.sql
33 #
34 #  To read back a PostgreSQL database use:
35 #     cd @working_dir@
36 #     dropdb bacula
37 #     psql bacula <bacula.sql
38 #