Skip to content
Browse files

2006-01-05 Alexis Sukrieh <sukria@backup-manager.org>

	* backup-manager.conf.tpl:
	  + added BM_MYSQL_SAFEDUMPS for providing a way to perform full clena
	  backup with the "--opt" switch (closes bug #15)
	  + Changed the behaviour of BM_MYSQL_DATABASES so we can put here a
	  wildcard "__ALL__" that means backing up every databases at once.
	* lib/backup-methods.sh:
	  + Changes in backup_mysql().




git-svn-id: svn://svn.backup-manager.org/backup-manager/trunk@299 2e458433-d701-0410-9826-f9b593394a3c
  • Loading branch information...
1 parent 5cf4878 commit e90e822eeaae946b946ab2a8e841a67b2f03312b sukria committed Jan 5, 2006
Showing with 81 additions and 13 deletions.
  1. +10 −0 ChangeLog
  2. +48 −2 backup-manager.conf.tpl
  3. +23 −11 lib/backup-methods.sh
View
10 ChangeLog
@@ -1,3 +1,13 @@
+2006-01-05 Alexis Sukrieh <sukria@backup-manager.org>
+
+ * backup-manager.conf.tpl:
+ + added BM_MYSQL_SAFEDUMPS for providing a way to perform full clena
+ backup with the "--opt" switch (closes bug #15)
+ + Changed the behaviour of BM_MYSQL_DATABASES so we can put here a
+ wildcard "__ALL__" that means backing up every databases at once.
+ * lib/backup-methods.sh:
+ + Changes in backup_mysql().
+
2005-12-31 Alexis Sukrieh <sukria@backup-manager.org>
* Bug #14 closed. Backup methods are handled better so we can
View
50 backup-manager.conf.tpl
@@ -11,12 +11,15 @@
##############################################################
# Repository - everything about where archives are
#############################################################
+
# Where to store the archives
export BM_REPOSITORY_ROOT="/var/archives"
+
# For security reasons, the archive repository and the generated
# archives will be readable/writable by a given user/group.
# This is recommended to set this to true.
export BM_REPOSITORY_SECURE="true"
+
# The repository will be readable/writable only by a specific
# user:group pair if BM_REPOSITORY_SECURE is set to true.
export BM_REPOSITORY_USER="root"
@@ -25,12 +28,15 @@ export BM_REPOSITORY_GROUP="root"
##############################################################
# Archives - let's focus on the precious tarballs...
##############################################################
+
# Number of days we have to keep an archive (Time To Live)
export BM_ARCHIVE_TTL="5"
+
# Do you want to replace duplicates by symlinks?
# (archive-DAY is a duplicate of archive-(DAY - 1) if they
# are both the same size).
export BM_ARCHIVE_PURGEDUPS="true"
+
# Prefix of every archive on that box (default is HOSTNAME)
export BM_ARCHIVE_PREFIX="$HOSTNAME"
@@ -50,30 +56,38 @@ export BM_ARCHIVE_METHOD="tarball"
# Section "TARBALL"
# - Backup method: tarball
#############################################################
+
# Archive filename format
# long : host-full-path-to-folder.tar.gz
# short : parentfolder.tar.gz
export BM_TARBALL_NAMEFORMAT="long"
+
# Type of archives, available types are tar, tar.gz, tar.bz2, zip.
export BM_TARBALL_FILETYPE="tar.gz"
+
# Do you want to dereference the files pointed by symlinks ?
# enter true or false (true can lead to huge archives, be careful).
export BM_TARBALL_DUMPSYMLINKS="false"
+
# Directories you want to backup as tarballs (separated by spaces)
export BM_TARBALL_DIRECTORIES="/etc /home"
+
# Files to exclude when generating tarballs
export BM_TARBALL_BLACKLIST=""
##############################################################
# The tarball-incremental method uses the same keys as the
# tarball method, plus two others.
#############################################################
+
# Which frequency to use for the master tarball?
# possible values: weekly, monthly
export BM_TARBALLINC_MASTERDATETYPE="weekly"
+
# Number of the day, in the BM_TARBALLINC_MASTERDATETYPE frequency
# when master tarballs should be made
export BM_TARBALLINC_MASTERDATEVALUE="1"
+
# Examples: you want to make maser tarballs every friday:
# BM_TARBALLINC_MASTERDATETYPE="weekly"
# BM_TARBALLINC_MASTERDATEVALUE="5"
@@ -85,34 +99,51 @@ export BM_TARBALLINC_MASTERDATEVALUE="1"
##############################################################
# Backup method: MYSQl
#############################################################
+
# This method is dedicated to MySQL databases.
# You should not use the tarball method for backing up database
# directories or you may have corrupted archives.
-# Enter here the list of databases
-export BM_MYSQL_DATABASES="mysql"
+# Enter here the list of databases to backup.
+# Wildcard: __ALL__ (will dump all the databases in one archive)
+export BM_MYSQL_DATABASES="__ALL__"
+
+# The best way to produce MySQL dump is done by using the "--opt" switch
+# of mysqldump. This make the dump directly usable with mysql (add the drop table
+# statements), lock the tables during the dump and other things.
+# This is recommended for full-clean-safe backups, but needs a
+# privileged user (for the lock permissions).
+export BM_MYSQL_SAFEDUMPS="true"
+
# The user who is allowed to read every databases filled in BM_MYSQL_DATABASES
export BM_MYSQL_ADMINLOGIN="root"
+
# its password
export BM_MYSQL_ADMINPASS=""
+
# the host where the database is
export BM_MYSQL_HOST="localhost"
+
# the port where MySQL listen to on the host
export BM_MYSQL_PORT="3306"
+
# which compression format to use? (gzip or bzip2)
export BM_MYSQL_FILETYPE="bzip2"
##############################################################
# Backup method: svn
#############################################################
+
# Absolute paths to the svn repositories to archive
export BM_SVN_REPOSITORIES=""
+
# You can compress the resulting XML files
# Supported compressor are: bzip2 and gzip
export BM_SVN_COMPRESSWITH="bzip2"
##############################################################
# Backup method: pipe
#############################################################
+
# The "pipe" method is a generic way of making archive.
# Its concept is simple, for every kind of archive you want
# to make, you give: a command which will send output on stdout,
@@ -158,46 +189,60 @@ export BM_PIPE_COMPRESS
# You can upload archives to remote hosts with different
# methods.
#############################################################
+
# Which method to use for uploading archives, you can put
# multiple methods here.
# Available methods:
# - scp
# - ftp
# - rsync
# - none
+
# If you don't want to use any upload method (you don't want to
# upload files to remote hosts) then choose "none"
export BM_UPLOAD_METHOD=""
+
# where to upload (global to all methods)
export BM_UPLOAD_HOSTS=""
+
# Where to put archives on the remote hosts (global)
export BM_UPLOAD_DESTINATION=""
##############################################################
# The SSH method
#############################################################
+
# the user to use for the SSH connections/transfers
export BM_UPLOAD_SSH_USER=""
+
# The private key to use for opening the connection
export BM_UPLOAD_SSH_KEY=""
+
# specific ssh hosts
export BM_UPLOAD_SSH_HOSTS=""
+
# port to use for SSH connections (leave blank for default one)
export BM_UPLOAD_SSH_PORT=""
+
# destination for ssh uploads (overrides BM_UPLOAD_DESTINATION)
export BM_UPLOAD_SSH_DESTINATION=""
##############################################################
# The FTP method
#############################################################
+
# the user to use for the FTP connections/transfers
export BM_UPLOAD_FTP_USER=""
+
# the FTP user's password
export BM_UPLOAD_FTP_PASSWORD=""
+
# FTP specific rmeote hosts
export BM_UPLOAD_FTP_HOSTS=""
+
# purge archives on remote hosts before uploading?
export BM_UPLOAD_FTP_PURGE="false"
+
# destination for FTP uploads (overrides BM_UPLOAD_DESTINATION)
export BM_UPLOAD_FTP_DESTINATION=""
@@ -252,6 +297,7 @@ export BM_BURNING_DEVICE="/dev/cdrom"
# e.g. BM_BURNING_DEVFORCED="/dev/cdrom"
# If none specified, the default cdrecord device will be used.
export BM_BURNING_DEVFORCED=""
+
# enter here the max size of your media
# (usal sizes are 4200 for DVD media and 700 or 800 for CDR media)
export BM_BURNING_MAXSIZE="700"
View
34 lib/backup-methods.sh
@@ -243,18 +243,30 @@ backup_method_mysql()
if [ ! -x $mysqldump ]; then
error "The \"mysql\" method is chosen, but \$mysqldump is not found."
fi
-
- for database in $BM_MYSQL_DATABASES
- do
- file_to_create="$BM_REPOSITORY_ROOT/${BM_ARCHIVE_PREFIX}-${database}.$TODAY.sql"
- command="$mysqldump -u$BM_MYSQL_ADMINLOGIN -p$BM_MYSQL_ADMINPASS -h$BM_MYSQL_HOST -P$BM_MYSQL_PORT $database"
- compress="$BM_MYSQL_FILETYPE"
-
- __exec_meta_command "$command" "$file_to_create" "$compress"
- file_to_create="$BM_RET"
- commit_archive "$file_to_create"
- done
+ opt=""
+ if [ "$BM_MYSQL_SAFEDUMPS" = "true" ]; then
+ opt="--opt"
+ fi
+ base_command="$mysqldump $opt -u$BM_MYSQL_ADMINLOGIN -p$BM_MYSQL_ADMINPASS -h$BM_MYSQL_HOST -P$BM_MYSQL_PORT"
+
+ if [ "$BM_MYSQL_DATABASES" = "__ALL__" ]
+ then
+ file_to_create="$BM_REPOSITORY_ROOT/${BM_ARCHIVE_PREFIX}-all-mysql-databases.$TODAY.sql"
+ command="$base_command --all-databases"
+ compress="$BM_MYSQL_FILETYPE"
+ else
+ for database in $BM_MYSQL_DATABASES
+ do
+ file_to_create="$BM_REPOSITORY_ROOT/${BM_ARCHIVE_PREFIX}-${database}.$TODAY.sql"
+ command="$base_command $database"
+ compress="$BM_MYSQL_FILETYPE"
+ done
+ fi
+
+ __exec_meta_command "$command" "$file_to_create" "$compress"
+ file_to_create="$BM_RET"
+ commit_archive "$file_to_create"
}
backup_method_svn()

0 comments on commit e90e822

Please sign in to comment.
Something went wrong with that request. Please try again.