]> git.sur5r.net Git - bacula/bacula/blob - bacula/src/win32/cats/make_mysql_catalog_backup.cmd
Remove obsolete .cvsignore files.
[bacula/bacula] / bacula / src / win32 / cats / make_mysql_catalog_backup.cmd
1 @ECHO off
2 REM 
3 REM  This script dumps your Bacula catalog in ASCII format
4 REM  It works for MySQL, SQLite, and PostgreSQL
5 REM 
6 REM   %1 is the name of the database to be backed up and the name
7 REM      of the output file (default = bacula
8 REM   %2 is the user name with which to access the database
9 REM      (default = bacula).
10 REM   %3 is the password with which to access the database or "" if no password
11 REM      (default "")
12 REM 
13 REM 
14 @ECHO on
15
16 DEL /f "@working_dir_cmd@\%1.sql" 2>nul
17
18 set MYSQLPASSWORD=
19
20 IF NOT "%3"=="" SET MYSQLPASSWORD=--password=%3
21 "@SQL_BINDIR@\mysqldump" -u %2 %MYSQLPASSWORD% -f --opt %1 > "@working_dir_cmd@\%1.sql"
22
23 @ECHO off
24 REM 
25 REM   To read back a MySQL database use: 
26 REM      cd @working_dir_cmd@
27 REM      rd /s /q @SQL_BINDIR@\..\data\bacula
28 REM      mysql < bacula.sql
29 REM 
30 REM   To read back a SQLite database use:
31 REM      cd @working_dir_cmd@
32 REM      del /f bacula.db
33 REM      sqlite bacula.db < bacula.sql
34 REM 
35 REM   To read back a PostgreSQL database use:
36 REM      cd @working_dir_cmd@
37 REM      dropdb bacula
38 REM      createdb bacula
39 REM      psql bacula < bacula.sql
40 REM
41 EXIT /b 0