28 lines
629 B
Bash
Executable file
28 lines
629 B
Bash
Executable file
#!/bin/sh
|
|
|
|
umask 077
|
|
|
|
# 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
|