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
|
||||
|
||||
# compact database
|
||||
echo "vacuum;" | sqlite3 /srv/bacula/bacula.db
|
||||
umask 077
|
||||
|
||||
# dump database to file
|
||||
echo ".dump" | sqlite3 /srv/bacula/bacula.db > /srv/bacula/bacula.sql
|
||||
# read settings
|
||||
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": {
|
||||
require mysql::client
|
||||
if !$dbpassword {
|
||||
fail("\$dbpassword is required for bacula::director when using '${dbadapter} database")
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue