]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/win32/cats/make_postgresql_catalog_backup.cmd
Restore win32 dir from Branch-5.2 and update it
[bacula/bacula] / bacula / src / win32 / cats / make_postgresql_catalog_backup.cmd
diff --git a/bacula/src/win32/cats/make_postgresql_catalog_backup.cmd b/bacula/src/win32/cats/make_postgresql_catalog_backup.cmd
new file mode 100644 (file)
index 0000000..759a101
--- /dev/null
@@ -0,0 +1,41 @@
+@ECHO off\r
+REM \r
+REM  This script dumps your Bacula catalog in ASCII format\r
+REM  It works for MySQL, SQLite, and PostgreSQL\r
+REM \r
+REM   %1 is the name of the database to be backed up and the name\r
+REM      of the output file (default = bacula\r
+REM   %2 is the user name with which to access the database\r
+REM      (default = bacula).\r
+REM   %3 is the password with which to access the database or "" if no password\r
+REM      (default "")\r
+REM \r
+REM \r
+@ECHO on\r
+\r
+DEL /f "@working_dir_cmd@\%1.sql" 2>nul\r
+\r
+SET PGPASSWORD=\r
+\r
+IF NOT "%3"=="" SET PGPASSWORD=--password=%3\r
+"@SQL_BINDIR@\pg_dump" -c -U %2 %1 >"@working_dir_cmd@\%1.sql"\r
+\r
+@ECHO off\r
+REM \r
+REM   To read back a MySQL database use: \r
+REM      cd @working_dir_cmd@\r
+REM      rd /s /q @SQL_BINDIR@\..\data\bacula\r
+REM      mysql < bacula.sql\r
+REM \r
+REM   To read back a SQLite database use:\r
+REM      cd @working_dir_cmd@\r
+REM      del /f bacula.db\r
+REM      sqlite bacula.db < bacula.sql\r
+REM \r
+REM   To read back a PostgreSQL database use:\r
+REM      cd @working_dir_cmd@\r
+REM      dropdb bacula\r
+REM      createdb -T template0 -E SQL_ASCII bacula\r
+REM      psql bacula < bacula.sql\r
+REM \r
+EXIT /b 0\r