aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NEWS35
-rw-r--r--README129
-rw-r--r--backup.in2
-rw-r--r--beam.conf31
-rw-r--r--beam.in2
-rw-r--r--doc/.gitignore4
-rw-r--r--doc/Makefile.am5
-rw-r--r--doc/beam-backup.1in4
-rw-r--r--doc/beam-cleaner.1in77
-rw-r--r--doc/beam-restore.1in4
-rw-r--r--doc/beam-s3.1in4
-rw-r--r--doc/beam.conf.5in10
-rw-r--r--lib/beam/common.in2
-rwxr-xr-xlib/beam/fs.sh2
-rw-r--r--lib/beam/mysql.sh2
-rwxr-xr-xlib/beam/postgres.sh2
-rw-r--r--lib/beam/s3.sh41
-rw-r--r--restore.in2
-rw-r--r--s3.in2
19 files changed, 302 insertions, 58 deletions
diff --git a/NEWS b/NEWS
index e69de29..72933a8 100644
--- a/NEWS
+++ b/NEWS
@@ -0,0 +1,35 @@
+BEAM NEWS -- history of user-visible changes. 2012-06-01
+Copyright (C) 2012 Sergey Poznyakoff.
+See the end of file for copying conditions.
+
+Please send mailutils bug reports to <gray@gnu.org.ua>.
+
+
+Version 1.2 (git)
+
+First release.
+
+
+----------------------------------------------------------------------
+Copyright information:
+
+Copyright (C) 2012 Sergey Poznyakoff.
+
+ Permission is granted to anyone to make or distribute verbatim copies
+ of this document as received, in any medium, provided that the
+ copyright notice and this permission notice are preserved,
+ thus giving the recipient permission to redistribute in turn.
+
+ Permission is granted to distribute modified versions
+ of this document, or of portions of it,
+ under the above conditions, provided also that they
+ carry prominent notices stating who last changed them.
+
+Local variables:
+mode: outline
+paragraph-separate: "[ ]*$"
+eval: (add-hook 'write-file-hooks 'time-stamp)
+time-stamp-start: "changes. "
+time-stamp-format: "%:y-%02m-%02d"
+time-stamp-end: "\n"
+end:
diff --git a/README b/README
index cee4adf..070bdc6 100644
--- a/README
+++ b/README
@@ -1 +1,128 @@
-This package provides generic backup and restore scripts.
+BEAM README file.
+Copyright (C) 2012 Sergey Poznyakoff
+See the end of file for copying conditions.
+
+* Introduction
+
+BEAM is a flexible and configurable tool for backup management. Its
+name is an acronym for "Backup Easy And Manageable". The tool
+provides utilities for backing up files and databases, restoring them
+from existing backups and examining backup archives.
+
+BEAM is written in a reasonably compatible POSIX shell language. The
+only deviation from the POSIX standard is that it makes use of the
+"local" keyword.
+
+* Prerequisites
+
+1. A POSIX-compatible shell that supports the "local" keyword. Most
+existing shells do.
+
+2. GNU tar version 1.16 or newer.
+
+3. For backing up MySQL databases: mysql and mysqldump.
+
+4. For backing up PostgreSQL databases: PostgreSQL. In fact, the
+following utilities are used: pg_dump, pg_restore, dropdb, createdb,
+and psql.
+
+5. If you plan to keep backups on Amazon S3 storage: s3backer. It is
+available from http://code.google.com/p/s3backer.
+
+* Installation
+
+The usual way:
+
+ ./configure
+ make
+ # [become root]
+ make install
+
+The configure script provides lot of options to tailor the
+installation to your needs.
+
+Most important options are:
+
+ --prefix=DIR
+ Use DIR as the installation prefix. Installation prefix is
+ appended to the normal paths when installing the system. BEAM
+ uses the following locations:
+
+ PREFIX/etc -- configuration directory
+ PREFIX/libexec -- directory for low-level beam utilities
+ PREFIX/lib/beam -- directory for beam modules.
+
+ --sysconfdir=DIR
+ Use DIR as the system configuration directory.
+
+ --libdir=DIR
+ Install BEAM modules in DIR/beam.
+
+ --libexecdir=DIR
+ Install low-level utilities in DIR.
+
+ --with-s3
+ Install modules for handling file systems backed by the Amazon
+ Simple Storage Service (Amazon S3).
+
+For the list of available generic options, consult the file INSTALL.
+
+* Overview
+
+The "beam" utility works as a primary dispatcher tool. It takes a
+command and its options as the arguments. The following commands
+are available:
+
+ beam backup - runs a backup
+ beam restore - restores from a backup
+ beam s3 - manages the s3-backed file system
+ beam help COMMAND - displays a short help for COMMAND
+
+Configuration settings are read from the file beam.conf, located in the
+system configuration directory (see above).
+
+The package uses modular structure which makes it extremely flexible.
+The low-level commands are located in the LIBEXECDIR. For example,
+running "beam backup" indirectly invokes LIBEXECDIR/beam-backup utility.
+
+Particular backup items are handled by modules, located in the
+directory PREFIX/lib/beam. Each module is a shell program providing
+primitives for a paricular task. For example, the mysql.sh module
+handles backups of MySQL databases.
+
+* Documentation
+
+The documentation in man page format is available:
+
+ beam(1)
+ beam-backup(1)
+ beam-restore(1)
+ beam-s3(1)
+ beam.conf(5)
+
+* Bug reporting
+
+Send bug reports to <gray@gnu.org.ua>.
+
+
+* Copyright information:
+
+Copyright (C) 2012 Sergey Poznyakoff
+
+ Permission is granted to anyone to make or distribute verbatim
+ copies of this document as received, in any medium, provided that
+ the copyright notice and this permission notice are preserved,
+ thus giving the recipient permission to redistribute in turn.
+
+ Permission is granted to distribute modified versions
+ of this document, or of portions of it,
+ under the above conditions, provided also that they
+ carry prominent notices stating who last changed them.
+
+
+Local Variables:
+mode: outline
+paragraph-separate: "[ ]*$"
+version-control: never
+End:
+
diff --git a/backup.in b/backup.in
index cbc9f08..2232c2c 100644
--- a/backup.in
+++ b/backup.in
@@ -1,4 +1,4 @@
-#! /bin/bash
+#! /bin/sh
# This file is part of BEAM
# Copyright (C) 2012 Sergey Poznyakoff
#
diff --git a/beam.conf b/beam.conf
index f18299d..9eac2b8 100644
--- a/beam.conf
+++ b/beam.conf
@@ -4,22 +4,26 @@
echo >&2 "$0: WARNING: using default configuration boilerplate"
# This file is essentially a shell script defining variables used by
-# the backup scripts. For a detailed information about it see beam.conf(5)
-# To debug the configuration, run "backup --dry-run" and "restore --dry-run".
-# For a detailed descriptions of these commands, see backup(1).
+# the backup scripts. For a detailed information about it, see beam.conf(5)
+# To debug the configuration, run "beam backup --dry-run" and
+# "beam restore --dry-run".
+# For a detailed descriptions of these commands, see beam(1).
-# When set, the prologue hook is called right before starting backup or
-# restore. Similarly, the epilogue_hook is called immediately after
-# finishing all operations.
-# Use these hooks to perform any preliminary and/or cleanup jobs that
-# might be necessary in your setup.
-# When set, these variables must point to shell functions taking no
-# arguments. The best place to define such functions is perhaps in this
-# configuration file as well.
+##########################################################################
+# Hooks
+##########################################################################
#
-# By default, both variables are empty, i.e. no hooks are executed.
+# Special variables, called hooks, allow you to supply arbitrary
+# procedures to be run before and after backup.
+# When set, both variables must contain a whitespace-separated list of
+# commands to be invoked. These commands will be invoked without arguments
+# and run in order of their appearance in the list.
+# The prologue_hook is a list of commands to run before starting backup
+# (or restore).
prologue_hook=
+# The epilogue_hook is a list of commands to run when the backup
+# (or restore) finishes.
epilogue_hook=
##########################################################################
@@ -30,7 +34,6 @@ epilogue_hook=
# If zero or empty, backups are retained forever.
backup_retain_interval=
-
##########################################################################
# S3 configuration.
##########################################################################
@@ -159,7 +162,7 @@ backup_sender_email=
# You can supply personal part of the sender email using this variable.
# The personal part will be enclosed in double quotes and prepended to
-# the value of $backup_sender_email to form a valid RFC-2822 From header.
+# the value of $backup_sender_email to form a valid RFC-2822 "From" header.
# For example, if you have:
# backup_sender_email=root@example.com
# backup_sender_personal="Automatic backup report"
diff --git a/beam.in b/beam.in
index 7df24de..480351c 100644
--- a/beam.in
+++ b/beam.in
@@ -1,4 +1,4 @@
-#! /bin/bash
+#! /bin/sh
libdir=@LIBDIR@/beam
set -e
diff --git a/doc/.gitignore b/doc/.gitignore
index 772d3c8..b46e6f4 100644
--- a/doc/.gitignore
+++ b/doc/.gitignore
@@ -1,3 +1,5 @@
beam-backup.1
beam-restore.1
-backup.conf.5
+beam-cleanup.1
+beam-s3.1
+beam.conf.5
diff --git a/doc/Makefile.am b/doc/Makefile.am
index 6396bd1..8619450 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -1,12 +1,13 @@
if COND_S3MOUNT
S3=beam-s3.1
endif
-man_MANS = beam.1 beam.conf.5 beam-backup.1 beam-restore.1 $(S3)
+man_MANS = beam.1 beam.conf.5 beam-backup.1 beam-restore.1 beam-cleaner.1 $(S3)
beam.1: beam.1in Makefile
beam-backup.1: beam-backup.1in Makefile
beam.conf.5: beam.conf.5in Makefile
beam-restore.1: beam-restore.1in Makefile
beam-s3.1: beam-s3.1in Makefile
+beam-cleanup.1: beam-cleanup.1in Makefile
EXTRA_DIST=beam.1in beam-backup.1in beam-restore.1in beam.conf.5in beam-s3.1in
-CLEANFILES=beam.1 beam.conf.5 beam-backup.1 beam-restore.1 beam-s3.1
+CLEANFILES=beam.1 beam.conf.5 beam-backup.1 beam-restore.1 beam-s3.1 beam-cleanup.1
include $(top_srcdir)/Make.rules
diff --git a/doc/beam-backup.1in b/doc/beam-backup.1in
index 5ddb39a..162c522 100644
--- a/doc/beam-backup.1in
+++ b/doc/beam-backup.1in
@@ -14,7 +14,7 @@
.\" You should have received a copy of the GNU General Public License
.\" along with BEAM. If not, see <http://www.gnu.org/licenses/>.
.\"
-.TH BEAM-BACKUP 1 "May 29, 2012" "BEAM" "BEAM User Reference"
+.TH BEAM-BACKUP 1 "June 1, 2012" "BEAM" "BEAM User Reference"
.SH NAME
beam-backup \- create a back up.
.SH SYNOPSIS
@@ -206,7 +206,7 @@ Sergey Poznyakoff
Report bugs to <@PACKAGE_BUGREPORT@>.
.\" Local variables:
.\" eval: (add-hook 'write-file-hooks 'time-stamp)
-.\" time-stamp-start: ".TH [A-Z_][A-Z0-9_]* [0-9] \""
+.\" time-stamp-start: ".TH [A-Z_][A-Z0-9_-]* [0-9] \""
.\" time-stamp-format: "%:B %:d, %:y"
.\" time-stamp-end: "\""
.\" time-stamp-line-limit: 20
diff --git a/doc/beam-cleaner.1in b/doc/beam-cleaner.1in
new file mode 100644
index 0000000..ee3365d
--- /dev/null
+++ b/doc/beam-cleaner.1in
@@ -0,0 +1,77 @@
+.\" This file is part of BEAM -*- nroff -*-
+.\" 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/>.
+.\"
+.TH BEAM-CLEANER 1 "June 1, 2012" "BEAM" "BEAM User Reference"
+.SH NAME
+beam-cleaner \- clean up old backup files.
+.SH SYNOPSIS
+.B beam-cleaner
+[\fB\-s\fR \fISUF\fR] [\fB\-r\fR \fIN\fs] [\fB\-vn\fR] \
+ [\fB\-\-suffix\fR \fISUF\fR] [\fB\-\-retain\fR \fIN\fR] \
+ [\fB\-\-verbose\fR] [\fB\-\-dry\-run\fR] \fBDIR\fR
+
+.B beam-cleaner
+[\fB\-h\fR] [\fB\-\-help\fR]
+.SH DESCRIPTION
+.B Beam-cleaner
+is an auxiliary utility run by
+.BR beam-backup (1)
+to remove outdated backup or snapshot files from
+.BR DIR .
+The tool measures file creation dates in weeks, from the beginning of
+year and relies on file naming convention described in
+.BR beam-backup (1)
+to determine them.
+.PP
+It deletes those files which are older than \fBN\fR weeks (\fBN\fR being
+supplied with the
+.B \-\-retain
+option).
+.PP
+Any files with names not matching the
+.BR beam-backup (1)
+naming scheme are ignored.
+.SH OPTIONS
+.TP
+\fB\-s\fR, \fB\-\-suffix\fR \fISUF\fR
+Consider only file names ending in \fBSUF\fR.
+.TP
+\fB\-r\fR, \fB\-\-retain\fR \fIN\fS
+Retain \fIN\fR last weeks of backups (default 3).
+.TP
+\fB\-v\fR, \fB\-\-verbose\fR
+Verbosely list what is being done.
+.TP
+\fB\-n\fR, \fB\-\-dry\-run\fR
+Do nothing, print what would have been done.
+.TP
+\fB\-h\fR, \fB\-\-help\fR
+Print a terse help list.
+.SH "SEE ALSO"
+.BR beam (1),
+.BR beam-backup (1),
+.BR beam.conf (5).
+.SH AUTHORS
+Sergey Poznyakoff
+.SH "BUG REPORTS"
+Report bugs to <@PACKAGE_BUGREPORT@>.
+.\" Local variables:
+.\" eval: (add-hook 'write-file-hooks 'time-stamp)
+.\" time-stamp-start: ".TH [A-Z_][A-Z0-9_-]* [0-9] \""
+.\" time-stamp-format: "%:B %:d, %:y"
+.\" time-stamp-end: "\""
+.\" time-stamp-line-limit: 20
+.\" end:
diff --git a/doc/beam-restore.1in b/doc/beam-restore.1in
index 0152df5..348462a 100644
--- a/doc/beam-restore.1in
+++ b/doc/beam-restore.1in
@@ -14,7 +14,7 @@
.\" You should have received a copy of the GNU General Public License
.\" along with BEAM. If not, see <http://www.gnu.org/licenses/>.
.\"
-.TH BEAM-RESTORE 1 "May 29, 2012" "BEAM" "BEAM User Reference"
+.TH BEAM-RESTORE 1 "June 1, 2012" "BEAM" "BEAM User Reference"
.SH NAME
beam-restore \- restore file system from a backup.
.SH SYNOPSIS
@@ -130,7 +130,7 @@ Sergey Poznyakoff
Report bugs to <@PACKAGE_BUGREPORT@>.
.\" Local variables:
.\" eval: (add-hook 'write-file-hooks 'time-stamp)
-.\" time-stamp-start: ".TH [A-Z_][A-Z0-9_]* [0-9] \""
+.\" time-stamp-start: ".TH [A-Z_][A-Z0-9_-]* [0-9] \""
.\" time-stamp-format: "%:B %:d, %:y"
.\" time-stamp-end: "\""
.\" time-stamp-line-limit: 20
diff --git a/doc/beam-s3.1in b/doc/beam-s3.1in
index 1779a9a..0b03a1d 100644
--- a/doc/beam-s3.1in
+++ b/doc/beam-s3.1in
@@ -14,7 +14,7 @@
.\" You should have received a copy of the GNU General Public License
.\" along with BEAM. If not, see <http://www.gnu.org/licenses/>.
.\"
-.TH BEAM-S3 1 "May 28, 2012" "BBE" "BBE User Reference"
+.TH BEAM-S3 1 "June 1, 2012" "BBE" "BBE User Reference"
.SH NAME
beam-s3 \- manage a backup s3 bucket
.SH SYNOPSIS
@@ -79,7 +79,7 @@ Sergey Poznyakoff
Report bugs to <@PACKAGE_BUGREPORT@>.
.\" Local variables:
.\" eval: (add-hook 'write-file-hooks 'time-stamp)
-.\" time-stamp-start: ".TH [A-Z_][A-Z0-9_]* [0-9] \""
+.\" time-stamp-start: ".TH [A-Z_][A-Z0-9_-]* [0-9] \""
.\" time-stamp-format: "%:B %:d, %:y"
.\" time-stamp-end: "\""
.\" time-stamp-line-limit: 20
diff --git a/doc/beam.conf.5in b/doc/beam.conf.5in
index 0c38cb8..10e47e8 100644
--- a/doc/beam.conf.5in
+++ b/doc/beam.conf.5in
@@ -350,17 +350,17 @@ Defines the mailer program. The default is
.sp
.SH HOOKS
Two special variables, called hooks, allow you to supply arbitrary
-procedures to be run before and after backup.
+commands to be run before and after backup.
.TP
.B prologue_hook
-This variable contains a whitespace-separated list of the commands to
-be invoked before starting backup (or restore). The commands are
+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
-This variable contains a whitespace-separated list of the commands to
-be invoked after the backup (or restore) has finished. The commands are
+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
without arguments. By default, this variable is empty.
.SH EXAMPLES
diff --git a/lib/beam/common.in b/lib/beam/common.in
index 1d4dfd9..519b23a 100644
--- a/lib/beam/common.in
+++ b/lib/beam/common.in
@@ -1,4 +1,4 @@
-#! /bin/bash
+#! /bin/sh
# This file is part of BEAM
# Copyright (C) 2012 Sergey Poznyakoff
#
diff --git a/lib/beam/fs.sh b/lib/beam/fs.sh
index 024b761..74553e3 100755
--- a/lib/beam/fs.sh
+++ b/lib/beam/fs.sh
@@ -1,4 +1,4 @@
-#! /bin/bash
+#! /bin/sh
# This file is part of BEAM
# Copyright (C) 2012 Sergey Poznyakoff
#
diff --git a/lib/beam/mysql.sh b/lib/beam/mysql.sh
index c33adb0..fd6e33c 100644
--- a/lib/beam/mysql.sh
+++ b/lib/beam/mysql.sh
@@ -1,4 +1,4 @@
-#! /bin/bash
+#! /bin/sh
# This file is part of BEAM
# Copyright (C) 2012 Sergey Poznyakoff
#
diff --git a/lib/beam/postgres.sh b/lib/beam/postgres.sh
index 0072da6..67769ce 100755
--- a/lib/beam/postgres.sh
+++ b/lib/beam/postgres.sh
@@ -1,4 +1,4 @@
-#! /bin/bash
+#! /bin/sh
# This file is part of BEAM
# Copyright (C) 2012 Sergey Poznyakoff
#
diff --git a/lib/beam/s3.sh b/lib/beam/s3.sh
index b365a54..39416d7 100644
--- a/lib/beam/s3.sh
+++ b/lib/beam/s3.sh
@@ -22,6 +22,24 @@ test -z "$backup_mp_s3backer" && backup_mp_s3backer=/mnt/s3backer
# The actual file system is mounted to /mnt/s3
test -z "$backup_mp" && backup_mp_s3=/mnt/s3
+s3_getmpoint()
+{
+ case $1 in
+ backer)
+ mount -tfuse.s3backer |
+ awk '/https?:\/\/'$backup_bucket_name'/ { print $3 }';;
+ s3)
+ s=$(mount | grep "^${backup_mp_s3backer}/file" | awk '{ print $3 }')
+ if [ -z "$s" ]; then
+ # Some kernels print device name instead of the actual mount file:
+ s=$(mount | grep "^/dev/loop[0-9] on ${backup_mp_s3}" | awk '{ print $3 }')
+ fi
+ echo $s;;
+ *)
+ abent 1 "invalid usage of getmpoint"
+ esac
+}
+
# This variable is populated by s3_mount and is used by s3_unmount to unmount
# s3-backed file system.
umount_list=""
@@ -34,8 +52,7 @@ s3_mount() {
# Sample mount output, split into several lines:
# http://finox-backup-fs.s3.amazonaws.com/ on /mnt/s3backer type fuse.s3backer
# (rw,nosuid,nodev,allow_other,default_permissions)
- set -- $(mount -tfuse.s3backer |
- awk '/https?:\/\/'$backup_bucket_name'/ { print $3 }')
+ set -- $(s3_getmpoint backer)
if test -z "$1"; then
$dry_run s3backer $backup_s3backer_options \
$backup_bucket_name $backup_mp_s3backer ||
@@ -44,7 +61,7 @@ s3_mount() {
else
backup_mp_s3backer=$1
fi
- set -- $(mount | grep "^${backup_mp_s3backer}/file" | awk '{ print $3 }')
+ set -- $(s3_getmpoint s3)
if test -z "$1"; then
case $(basename $0) in
beam-restore|restore) mountopt=",ro";;
@@ -62,24 +79,6 @@ s3_mount() {
epilogue_hook="s3_unmount $epilogue_hook"
}
-s3_getmpoint()
-{
- case $1 in
- backer)
- mount -tfuse.s3backer |
- awk '/https?:\/\/'$backup_bucket_name'/ { print $3 }';;
- s3)
- s=$(mount | grep "^${backup_mp_s3backer}/file" | awk '{ print $3 }')
- if [ -z "$s" ]; then
- # Some kernels print device name instead of the actual mount file:
- s=$(mount | grep "^/dev/loop[0-9] on ${backup_mp_s3}" | awk '{ print $3 }')
- fi
- echo $s;;
- *)
- abent 1 "invalid usage of getmpoint"
- esac
-}
-
s3_unmount()
{
for id in s3 backer
diff --git a/restore.in b/restore.in
index 933a260..e9d730d 100644
--- a/restore.in
+++ b/restore.in
@@ -1,4 +1,4 @@
-#! /bin/bash
+#! /bin/sh
# This file is part of BEAM
# Copyright (C) 2012 Sergey Poznyakoff
#
diff --git a/s3.in b/s3.in
index 57d53a3..ab46017 100644
--- a/s3.in
+++ b/s3.in
@@ -1,4 +1,4 @@
-#! /bin/bash
+#! /bin/sh
# This file is part of BEAM
# Copyright (C) 2012 Sergey Poznyakoff
#

Return to:

Send suggestions and report system problems to the System administrator.