aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2012-07-13 15:39:16 +0300
committerSergey Poznyakoff <gray@gnu.org.ua>2012-07-13 15:39:16 +0300
commit35212ddd3ceb7d3b20957b9ce6786f4ddd716bbe (patch)
tree5d52d7295c639f0c905d0461f1dfe237b97b51e5
parentdd89ed279f6948fab60319262ffc4d25da8ecd10 (diff)
downloadbeam-35212ddd3ceb7d3b20957b9ce6786f4ddd716bbe.tar.gz
beam-35212ddd3ceb7d3b20957b9ce6786f4ddd716bbe.tar.bz2
Add a LDAP backup module.
* lib/beam/ldap.sh: New file. * lib/beam/Makefile.am (libbackup_SCRIPTS,EXTRA_DIST): Add ldap.sh. * beam.conf: Update, mention new backup type. * doc/beam.conf.5in: Update. * lib/beam/common.in (load_config): If backup_archive_dir is not set, and S3 backup is configured, set backup_archive_dir to $backup_mp_s3. (beam_logrotate): Add missingok to the logrotate configuration. * lib/beam/fs.sh: List configuration keywords. * lib/beam/mysql.sh: Likewise. * lib/beam/postgres.sh: Likewise. * lib/beam/s3.sh: Likewise.
-rw-r--r--beam.conf13
-rw-r--r--doc/beam.conf.5in183
-rw-r--r--lib/beam/Makefile.am2
-rw-r--r--lib/beam/common.in9
-rwxr-xr-xlib/beam/fs.sh10
-rwxr-xr-xlib/beam/ldap.sh164
-rwxr-xr-xlib/beam/mysql.sh13
-rwxr-xr-xlib/beam/postgres.sh7
-rw-r--r--lib/beam/s3.sh3
9 files changed, 343 insertions, 61 deletions
diff --git a/beam.conf b/beam.conf
index ce16b50..f416088 100644
--- a/beam.conf
+++ b/beam.conf
@@ -92,13 +92,17 @@ backup_suffix="tar.bz2"
#
# This variable must be set. Whatever directory it points to must already
# exist, the backup script won't create it.
-backup_archive_dir=/var/run
+#
+# The only exception to this is when backup_bucket_name is defined. In
+# that case, if backup_archive_dir is empty, it is assigned to the value
+# of backup_mp_s3 variable. This directory will be created, if needed.
+backup_archive_dir=/var/backups
# Directory where to store snapshot files. The files will be named as
# their archive counterparts, with the suffix ".db".
#
# This variable must be set
-backup_snapshot_dir=/var/run
+backup_snapshot_dir=/var/lib/backups
# Set this variable to a non-empty value if you wish backup procedures to
# be verbose.
@@ -124,12 +128,13 @@ backup_verbose=
backup_items="dbdump system"
# For each item in $backup_items, at least its type (variable <item>_type)
-# must be declared. The item type determines the mechanism used to backup
+# must be declared. Item type determines the mechanism used to back up
# and restore it. Valid item types are:
#
# fs back up a file system
# postgres back up a postgres database
-# mysql backu up a mysql database
+# mysql back up a mysql database
+# ldap back up an LDAP database
#
# You may define additional types, if you need. To do so, create an executable
# file named <type>.sh in the directory @LIBDIR@/beam.
diff --git a/doc/beam.conf.5in b/doc/beam.conf.5in
index 9aa571c..8cad913 100644
--- a/doc/beam.conf.5in
+++ b/doc/beam.conf.5in
@@ -19,9 +19,9 @@
beam.conf \- configuration file for
.B backup becomes easy
.SH DESCRIPTION
-The \fBbeam.conf\fR configuration file defines what files are to be
-included in the backup, what backup methods to use and where to store
-the resulting archives. The
+The \fBbeam.conf\fR file defines what data are to be included in the
+backup, what backup methods to use and where to store the resulting
+archives. The
.BR backup (1)
and
.BR restore (1)
@@ -30,17 +30,39 @@ utilities expect to find it in the
directory.
.SH SYNTAX
The file is essentially a shell script that defines variables
-controlling backup and restore procedures. The names of the variables
+controlling backup and restore procedures. Names of the variables
used by the backup scripts begin with
.BR backup_ .
.SH GENERAL SETUP
.TP
-.B backup_logfile
+.BR backup_logfile = \fIFILE\fR
If set, redirect standard error and standard output to that file. The
file will be created if it does not exist. Otherwise, the output will be
appended to it.
+
+By default, this file will be automatically rotated. See
+.B openlog_hook
+below for a discussion of this.
.TP
-.B backup_rsh_command
+.BR backup_logrotate_conf = \fITEXT\fR
+Configuration text for
+.BR logrotate (8),
+used to rotate the logfile. The default corresponds to:
+.sp
+.nf
+.in +2
+backup_logrotate_conf = "
+ weekly
+ rotate 4"
+.in
+.fi
+.sp
+Note, that no block statements are allowed within
+.BR backup_logrotate_conf ,
+because its entire contents will be placed within an appropriate block
+statement.
+.TP
+.BR backup_rsh_command = \fICOMMAND\fR
Use this command to access remote archives. Unless set, the backup
utilities will first look for an executable file named
.BR @BINDIR@/speedssh .
@@ -48,7 +70,7 @@ If not found, they will fall back to using \fB/usr/bin/ssh\fR. It is
the responsibility of the administrator to provide for authentication
on the remote system, e.g. by using shared-key authentication.
.TP
-.B backup_retain_interval
+.BR backup_retain_interval = \fINUMBER\fR
Sets the interval, in weeks, during which old backups and snapshots
are retained. Empty value or zero means never delete the backups.
@@ -64,7 +86,7 @@ bucket you will need the
.BR s3backer (1)
utility.
.TP
-.B backup_s3backer_options
+.BR backup_s3backer_options = \fILIST\fR
Additional options for
.BR s3backer (1).
@@ -72,18 +94,18 @@ Use it, e.g., to pass the
.B \-\-vhost
option if your bucket is located outside of the US region.
.TP
-.B backup_bucket_name
+.BR backup_bucket_name = \fISTRING\fR
Sets the name of the
.B s3
bucket to keep the archives in.
.TP
-.B backup_mp_s3backer
+.BR backup_mp_s3backer = \fIDIR\fR
Defines mount point for the "raw" bucket.
Default value is
.BR /mnt/s3backer .
.TP
-.B backup_mp_s3
+.BR backup_mp_s3 = \fIDIR\fR
Defines mount point for the actual s3-backed filesystem.
Default value is
@@ -92,15 +114,15 @@ Default value is
Tar setup variables control additional options and arguments passed to
.BR tar (1).
.TP
-.B backup_tar_options
+.BR backup_tar_options = \fILIST\fR
Use this variable to pass additional options to tar. Do not place tar
operation switches (such as \fB-c\fR, \fB-t\fR, etc.) here! These
will be added automatically by appropriate scripts, depending on the
-operation being performed
+operation being performed.
By default this variable is empty (no additional options passed to tar).
.TP
-.B backup_suffix
+.BR backup_suffix = \fISTRING\fR
This variable supplies suffix for created archive names. The default
is
.B tar .
@@ -117,7 +139,7 @@ backup_suffix="tar.bz2"
.fi
.sp
.TP
-.B backup_archive_dir
+.BR backup_archive_dir = \fIDIR\fR
Directory where archive files are located. It's OK to specify
a remote directory here, e.g.
.sp
@@ -129,14 +151,23 @@ backup_archive_dir="10.10.0.1:/export/backup"
.sp
This variable must be defined and whatever directory it points to must
already exist.
+
+If it is not defined and
+.B backup_bucket_name
+is set, indicating that the
+.B S3
+storage is used for backups,
+.B backup_archive_dir
+will be set automatically to the same value as
+.BR backup_mp_s3 .
.TP
-.B backup_snapshot_dir
+.BR backup_snapshot_dir = \fIDIR\fR
Directory for incremental snapshot files. These files are be named after
their archive counterparts, by appending the
.B .db
suffix.
.TP
-.B backup_verbose
+.BR backup_verbose = \fIN\fR
Set this variable to any non-empty value to request additional
verbosity. The effect of this setting depends on backup methods being
used. For example, the
@@ -152,49 +183,55 @@ identifies information that needs to be backed up. Syntactically,
items follow the same rules as shell variable names. Backup items
are introduced using the following variable:
.TP
-.B backup_items
+.BR backup_items = \fILIST\fR
A whitespace-separated list of backup items.
.PP
For each backup item
-.B name
+.I name
the configuration file must provide a set of variables describing
where to obtain this information and how to store it to the archive.
These variables follow the same naming convention:
.sp
.nf
.in +2
-\fBname\fR_\fBvar\fR
+\fIname\fR_\fBvar\fR
.in
.fi
.sp
-where \fBname\fR is the item name and \fIvar\fR is a valid shell
+where \fIname\fR is the item name and \fBvar\fR is a valid shell
identifier.
-The
-.B \fBname\fR_type
-variable must always be defined. It identifies the backup method
-to be applied to that item. Currently two backup methods are
-implemented:
+The \fIname\fR_\fBtype\fR variable must always be defined. It
+identifies the backup method to be applied to that item. The
+following backup methods are implemented:
.TP
.B fs
A file system backup.
.TP
.B postgres
-Backup of a PostgreSQL database.
+Backup of PostgreSQL databases.
+.TP
+.B mysql
+Backup of MySQL databases.
+.TP
+.B ldap
+Backup of LDAP databases.
.SH FS BACKUP TYPE
-This is the basic backup type, which means incremental backups of a
+This is the basic backup type. It creates incremental backups of a
specified file system. For each item of this type, the following
variables must be defined:
.TP
-.B \fIitem\fB_dir
+.BR \fIitem\fB_dir = \fIPATH\fR
The absolute path to the file system being backed up.
.TP
-.B \fIitem\fB_files
+.BR \fIitem\fB_files = \fILIST\fR
A whitespace-separated list of directories and/or files in the
.B \fIitem\fB_dir
directory.
+.PP
+The following variables are optional:
.TP
-.B \fIitem\fB_exclude
+.BR \fIitem\fB_exclude = \fILIST\fR
A whitespace-separated list of file names (or
.BR glob (3)
patterns) to exclude from archivation. This is translated to
@@ -212,13 +249,13 @@ system_exclude="'var/spool/mail/*'"
.fi
.sp
.TP
-.B \fIitem\fB_exclude_from
+.BR \fIitem\fB_exclude_from = \fILIST\fR
A list of files to read exclusion patterns from. It is translated
into a list of
.B \-\-exclude\-from
options.
.TP
-.B \fIitem\fB_tar_options
+.BR \fIitem\fB_tar_options = \fILIST\fR
A list of additional options to pass to tar. Use this with caution.
.PP
For example:
@@ -242,27 +279,64 @@ type creates a dump of a PostgreSQL database and archives it using
.BR tar (1).
The following variables must be defined for items of this type:
.TP
-.B \fIitem\fB_database
+.BR \fIitem\fB_database = \fISTRING\fR
The database name.
.SH MYSQL BACKUP TYPE
The
.B mysql
-backup type creates a dump of a MySQL database and archives it witj
+backup type creates a dump of a MySQL database and archives it with
.BR tar (1).
The database to dump and access credentials are specified using the
following variables:
.TP
-.B \fIitem\fR_database
-The database name.
+.BR \fIitem\fB_database = \fISTRING\fR
+The database name. If this variable is empty, all databases will be
+dumped.
.TP
-.B \fIitem\fR_defaults_file
-A full pathname of the MySQL defaults file containing credenitals for
+.BR \fIitem\fB_defaults_file = \fIFILE\fR
+A full pathname of the MySQL defaults file which contains credentials for
accessing this database. This file must have at least the
.B mysqldump
and
.B mysql
sections, the former being used when dumping the database and the
latter when restoring it.
+.SH LDAP BACKUP TYPE
+A LDAP database is introduced with the
+.B ldap
+backup type. The following keywords specify what to backup:
+.TP
+.BR \fIitem\fB_database_directory = \fIDIR\fR
+Specifies the pathname of a directory that contains the database
+files. This is used at restore time to clean up old database contents
+prior to restoring it.
+.TP
+.BR \fIitem\fB_database_number = \fINUMBER\fR
+Number of the database to dump, if your LDAP configuration contains
+several databases. If absent, all databases will be dumped. This
+keyword cannot be used in conjunction with
+.B \fIitem\fB_database_suffix
+(see below).
+.TP
+.BR \fIitem\fB_database_suffix = \fISTRING\fR
+Use the specified suffix to determine which database to operate upon.
+.TP
+.BR \fIitem\fB_uri = \fIURI\fR
+Use dn, scope and filter from the supplied argument URI to handle
+only matching entries.
+.TP
+.BR \fIitem\fB_user = \fINAME\fR
+Restore the database with the privileges of this user.
+.TP
+.BR \fIitem\fB_slapcat_options = \fILIST\fR
+A list of additional options for
+.BR slapcat (8C).
+Use with caution.
+.TP
+.BR \fIitem\fB_slapadd_options = \fILIST\fR
+A list of additional options to pass to
+.BR slapadd (8C)
+when restoring from the backup.
.SH MAIL NOTIFICATION
Apart from usual logging, backup reports can be sent via email to
selected recipients. To enable this feature, the variable
@@ -273,11 +347,11 @@ addresses.
A number of variables is provided to customize the email headers and
contents.
.TP
-.B backup_notify_email
+.BR backup_notify_email = \fILIST\fR
Sets a list of emails to receive backup report. Multiple emails must
be separated with commas. If not set, no notification will be sent.
.TP
-.B backup_sender_email
+.BR backup_sender_email = \fIEMAIL\fR
Defines the sender email address. Backup reports will appear to be
sent from this address. The default value is
\fBroot\fR@\fIhostname\fR, when \fIhostname\fR is the name of the host
@@ -293,7 +367,7 @@ backup_sender_email=root@example.com
.fi
.sp
.TP
-.B backup_sender_personal
+.BR backup_sender_personal = \fISTRING\fR
Defines personal part of the sender email. The personal part will be
enclosed in double quotes and prepended to the value of
.B backup_sender_email
@@ -317,7 +391,7 @@ From: "Automatic backup report" <root@example.com>
.fi
.sp
.TP
-.B backup_report_headers
+.BR backup_report_headers = \fILIST\fR
Defines additional headers for the report message. By default, the
following headers are generated:
.BR From ,
@@ -326,21 +400,22 @@ following headers are generated:
.BR X-Beam-Items ,
.BR X-Beam-Round ,
and
-.BR X-Beam-Level . The three \fBX-\fR headers contain the backed up
+.BR X-Beam-Level .
+The three \fBX-\fR headers contain the backed up
items (as set in the
.B backup_items
variable), backup round and backup level numbers, correspondingly.
To supply multiple headers, delimit them with single newline characters.
.TP
-.B backup_report_intro
+.BR backup_report_intro = \fITEXT\fR
Sets the introductory text to be displayed before the actual report.
.TP
-.B backup_report_signature
+.BR backup_report_signature = \fITEXT\fR
Sets the signature text, which will be output after the report body.
.TP
-.B backup_mailer_program
-Defines the mailer program. The default is
+.BR backup_mailer_program = \fICOMMAND\fR
+Defines the mailer program and its arguments. The default is
.sp
.nf
.in +2
@@ -349,10 +424,10 @@ Defines the mailer program. The default is
.fi
.sp
.SH HOOKS
-Two special variables, called hooks, allow you to supply arbitrary
-commands to be run before and after backup.
+Special variables, called hooks, allow you to supply arbitrary
+commands to be run at particular stages of the backup or restore process.
.TP
-.B openlog_hook
+.BR openlog_hook = \fILIST\fR
Commands listed in this variable are run before opening the logfile. The
most common use for this hook is to rotate an oversized logfile prior to
opening it.
@@ -365,16 +440,16 @@ to manage the log file. Configuration for
.BR logrotate (8)
can be supplied in the
.B backup_logrotate_conf
-variable. By default, the log file is rotated weekly, 4
+variable. By default, the log file is rotated weekly and 4
weeks worth of backlogs are preserved.
.TP
-.B prologue_hook
+.BR prologue_hook = \fILIST\fR
This variable contains a whitespace-separated list of commands to
be invoked before starting backup (or restore). These commands are
started in order of their appearance in the list and are called
without arguments. By default, this variable is empty.
.TP
-.B epilogue_hook
+.BR epilogue_hook = \fILIST\fR
This variable contains a whitespace-separated list of commands to
be invoked after the backup (or restore) has finished. These commands are
started in order of their appearance in the list and are called
diff --git a/lib/beam/Makefile.am b/lib/beam/Makefile.am
index d490acb..22c9a12 100644
--- a/lib/beam/Makefile.am
+++ b/lib/beam/Makefile.am
@@ -19,12 +19,14 @@ libbackup_SCRIPTS=\
common.sh\
s3.sh\
fs.sh\
+ ldap.sh\
mysql.sh\
postgres.sh
EXTRA_DIST=\
common.in\
s3.sh\
fs.sh\
+ ldap.sh\
mysql.sh\
postgres.sh
DISTCLEANFILES=common.sh
diff --git a/lib/beam/common.in b/lib/beam/common.in
index 6ce25fe..4c6cd21 100644
--- a/lib/beam/common.in
+++ b/lib/beam/common.in
@@ -71,6 +71,14 @@ load_config() {
abend 1 "backup_items not specified"
fi
+ if [ -z "$backup_archive_dir" ]; then
+ if [ -n "$backup_bucket_name" ]; then
+ backup_archive_dir=$backup_mp_s3
+ else
+ abend 1 "backup_archive_dir not set"
+ fi
+ fi
+
delayed_exit=
loaded_types=
for item in $backup_items
@@ -198,6 +206,7 @@ rotate 4
cat > $conf <<EOF
$backup_logfile {
$backup_logrotate_conf
+missingok
}
EOF
umask $u
diff --git a/lib/beam/fs.sh b/lib/beam/fs.sh
index 6c09e61..42da67b 100755
--- a/lib/beam/fs.sh
+++ b/lib/beam/fs.sh
@@ -15,6 +15,16 @@
# You should have received a copy of the GNU General Public License
# along with BEAM. If not, see <http://www.gnu.org/licenses/>.
+# Configuration keywords:
+#
+# item_type=fs [mandatory]
+# item_dir=STRING [mandatory]
+# item_files=STRING [mandatory]
+# item_exclude=STRING [optional]
+# item_exclude_from=STRING [optional]
+# item_tar_options=STRING [optional internal]
+#
+
# initdb item
# Initializes snapshot for the given basename.
initdb() {
diff --git a/lib/beam/ldap.sh b/lib/beam/ldap.sh
new file mode 100755
index 0000000..f6e56b8
--- /dev/null
+++ b/lib/beam/ldap.sh
@@ -0,0 +1,164 @@
+#! /bin/sh
+# This file is part of BEAM
+# Copyright (C) 2012 Sergey Poznyakoff
+#
+# BEAM is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# BEAM is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with BEAM. If not, see <http://www.gnu.org/licenses/>.
+
+# Configuration keywords:
+#
+# item_type=ldap [mandatory]
+# item_database_directory=string [mandatory]
+# item_database_number=n [optional *]
+# item_database_suffix=suf [optional *]
+# item_uri=str [optional]
+# item_user=name [optional]
+# item_slapcat_options=string [optional internal]
+# item_slapadd_options=string [optional internal]
+#
+# * - mutually exclusive keywords.
+
+
+# ldap_check item
+ldap_check() {
+ local rc=0 dbno dbsuf dbdir
+ eval dbno=\$${1}_database_number \
+ dbsuf=\$${1}_database_suffix \
+ dbdir=\$${1}_database_directory
+ if test -n "$dbno" && test -n "$dbsuf"; then
+ error "$1: both ${1}_database_number and ${1}_database_suffix are set"
+ rc=1
+ fi
+ if test -z "$dbdir"; then
+ error "${1}_database_directory not configured"
+ rc=1
+ fi
+ if ! test -d "$dbdir"; then
+ error "LDAP database directory $dbdir does not exist"
+ error "(set by ${1}_database_directory)"
+ fi
+ return $rc
+}
+
+# ldap_list item prefix
+ldap_list() {
+ local dbid
+
+ eval dbid=\$${1}_database_number
+ if [ -n "$dbid" ]; then
+ dbid=" number $dbid"
+ else
+ eval dbid=\$${1}_database_suffix
+ if [ -n "$dbid" ]; then
+ dbid=" suffixed with $dbid"
+ fi
+ fi
+
+ echo "${2}LDAP database"$dbid
+}
+
+# ldap_backup item
+ldap_backup() {
+ local options dbno dbsuf uri
+
+ logit "backing up LDAP database $1"
+
+ eval options=\$${1}_slapcat_options \
+ dbno=\$${1}_database_number \
+ dbsuf=\$${1}_database_suffix
+
+ if [ -n "$dbno" ]; then
+ options="$options -n$dbnum"
+ elif [ -n "$dbsuf" ]; then
+ options="$options -b$slapcat"
+ fi
+
+ eval uri=\"\$${1}_uri\"
+ if [ -n "$uri" ]; then
+ options="$options -H\"$uri\""
+ fi
+
+ if [ -z "$dry_run" ]; then
+ slapcat $options > $backup_snapshot_dir/$1-$week-$round-$level
+ else
+ echo "slapcat $options > $backup_snapshot_dir/$1-$week-$round-$level"
+ fi
+
+ if [ $? -ne 0 ]; then
+ tarerror=$((tarerror + 1))
+ logit "failed"
+ else
+ logit "creating $1-$week-$round-$level.$tar_suffix"
+ $dry_run tar $verbose $taroptions \
+ -f $backup_archive_dir/$1-$week-$round-$level.$tar_suffix \
+ -C $backup_snapshot_dir $1-$week-$round-$level
+ tarcode $?
+ $dry_run rm $backup_snapshot_dir/$1-$week-$round-$level
+ fi
+}
+
+# ldap_restore item
+ldap_restore() {
+ local options dbno dbsuf dbdir u user
+
+ logit "extracting LDAP database dump $1"
+
+ eval options=\$${1}_slapadd_options dbno=\$${1}_database_number \
+ dbsuf=\$${1}_database_suffix dbdir=\$${1}_database_directory \
+ user=\$${1}_user
+
+ if test -z "$dbdir"; then
+ error "${1}_database_directory not configured"
+ tarerror=$((tarerror + 1))
+ return
+ fi
+ if [ -n "$dbno" ]; then
+ options="$options -n$dbnum"
+ elif [ -n "$dbsuf" ]; then
+ options="$options -b$slapcat"
+ fi
+
+ u=$(umask)
+ trap "umask $u" 1 2 3 13 15
+ umask 077
+ $dry_run tar $verbose $taroptions \
+ -f $backup_archive_dir/$1-$week-$round-$level.$tar_suffix
+ e=$?
+ tarcode $e
+ if [ $e -eq 0 ]; then
+ prevdbtar=$backup_snapshot_dir/ldap-$1-$(date +%Y%m%dT%H%M%S).tar
+ logit "archiving the previous database contents to $prevdbtar"
+ $dry_run tar $verbose -c -f $prevdbtar $dbdir
+ e=$?
+ tarcode $e
+ umask $u
+ if [ $e -ne 0 ]; then
+ error "Failed to backup the prior database contents to $prevdbtar"
+ return
+ fi
+ logit "removing old database files in $dbdir"
+ $dry_run rm $dbdir/*
+ logit "restoring database $1 from the dump"
+ if test -n "$user"; then
+ su $user -c "$dry_run slapadd $options $verbose -l $1-$week-$round-$level"
+ su $user -c "$dry_run slapindex"
+ else
+ $dry_run slapadd $options $verbose -l $1-$week-$round-$level
+ $dry_run slapindex
+ fi
+ # FIXME: error checking
+ $dry_run rm $1-$week-$round-$level
+ fi
+ umask $u
+ trap - 1 2 3 13 15
+}
diff --git a/lib/beam/mysql.sh b/lib/beam/mysql.sh
index c172f44..4ce3a88 100755
--- a/lib/beam/mysql.sh
+++ b/lib/beam/mysql.sh
@@ -15,6 +15,13 @@
# You should have received a copy of the GNU General Public License
# along with BEAM. If not, see <http://www.gnu.org/licenses/>.
+# Configuration keywords:
+#
+# item_type=mysql [mandatory]
+# item_database=STRING [optional]
+# item_defaults_file=STRING [optional]
+#
+
# mysql_check item
mysql_check() {
return 0
@@ -36,8 +43,12 @@ mysql_list() {
mysql_backup() {
local database
- logit "backing up MySQL database $1"
eval database=\$${1}_database
+ if [ -z "$database" ]; then
+ logit "backing up all MySQL databases"
+ else
+ logit "backing up MySQL database $database"
+ fi
cmd="mysqldump"
eval defaults_file=\$${1}_defaults_file
if [ -n "$defaults_file" ]; then
diff --git a/lib/beam/postgres.sh b/lib/beam/postgres.sh
index 31bf9d6..0eba767 100755
--- a/lib/beam/postgres.sh
+++ b/lib/beam/postgres.sh
@@ -15,6 +15,11 @@
# You should have received a copy of the GNU General Public License
# along with BEAM. If not, see <http://www.gnu.org/licenses/>.
+# Configuration keywords:
+#
+# item_type=postgres [mandatory]
+# item_database=STRING [mandatory]
+
# postgres_check item
postgres_check() {
local database
@@ -36,8 +41,8 @@ postgres_list() {
postgres_backup() {
local database
- logit "backing up PostgreSQL $1"
eval database=\$${1}_database
+ logit "backing up PostgreSQL database $database"
test -z "$database" && abend 1 "${1}_database not set"
if [ -z "$dry_run" ]; then
su postgres -c "pg_dump $verbose $database" > $backup_snapshot_dir/$1-$week-$round-$level
diff --git a/lib/beam/s3.sh b/lib/beam/s3.sh
index 194e035..de71456 100644
--- a/lib/beam/s3.sh
+++ b/lib/beam/s3.sh
@@ -1,4 +1,5 @@
-# This file is part of BEAM -*- shell-script -*-
+#! /bin/sh
+# This file is part of BEAM
# Copyright (C) 2012 Sergey Poznyakoff
#
# BEAM is free software; you can redistribute it and/or modify

Return to:

Send suggestions and report system problems to the System administrator.