bacula: Added support for MySQL catalog backup.
This commit is contained in:
parent
ce958b5e3e
commit
901b8ca93c
2 changed files with 26 additions and 4 deletions
|
@ -1,7 +1,28 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
# compact database
|
umask 077
|
||||||
echo "vacuum;" | sqlite3 /srv/bacula/bacula.db
|
|
||||||
|
|
||||||
# dump database to file
|
# read settings
|
||||||
echo ".dump" | sqlite3 /srv/bacula/bacula.db > /srv/bacula/bacula.sql
|
eval `dbcheck -B -c /etc/bacula/bacula-dir.conf`
|
||||||
|
|
||||||
|
backupfile="${working_dir}/bacula.sql"
|
||||||
|
|
||||||
|
case $db_type in
|
||||||
|
MySQL)
|
||||||
|
cat <<EOF > ${working_dir}/my.cnf
|
||||||
|
[client]
|
||||||
|
host="${db_address}"
|
||||||
|
user="${db_user}"
|
||||||
|
password="${db_password}"
|
||||||
|
EOF
|
||||||
|
MYSQL_HOME=${working_dir} mysqldump ${db_name} > ${backupfile}
|
||||||
|
rm ${working_dir}/my.cnf
|
||||||
|
;;
|
||||||
|
SQLite)
|
||||||
|
echo "vacuum;" | sqlite3 ${working_dir}/bacula.db
|
||||||
|
echo ".dump" | sqlite3 ${working_dir}/bacula.db > ${backupfile}
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "ERR: No dump support for '${db_type}' database"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
|
@ -144,6 +144,7 @@ class bacula::director($password=undef,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
"mysql": {
|
"mysql": {
|
||||||
|
require mysql::client
|
||||||
if !$dbpassword {
|
if !$dbpassword {
|
||||||
fail("\$dbpassword is required for bacula::director when using '${dbadapter} database")
|
fail("\$dbpassword is required for bacula::director when using '${dbadapter} database")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue