aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Make.rules16
-rw-r--r--Makefile.am33
-rw-r--r--backup.in39
-rw-r--r--beam.conf (renamed from backup.conf)10
-rw-r--r--beam.in58
-rwxr-xr-xcleaner.in (renamed from backup-cleaner)6
-rw-r--r--configure.ac20
-rw-r--r--doc/.gitignore4
-rw-r--r--doc/Makefile.am17
-rw-r--r--doc/beam-backup.1in (renamed from doc/backup.1in)68
-rw-r--r--doc/beam-restore.1in (renamed from doc/restore.1in)50
-rw-r--r--doc/beam-s3.1in87
-rw-r--r--doc/beam.1in139
-rw-r--r--doc/beam.conf.5in (renamed from doc/backup.conf.5in)32
-rw-r--r--lib/Makefile.am2
-rw-r--r--lib/backup/Makefile.am15
-rw-r--r--lib/beam/.gitignore (renamed from lib/backup/.gitignore)0
-rw-r--r--lib/beam/Makefile.am31
-rw-r--r--lib/beam/common.in (renamed from lib/backup/common.in)41
-rwxr-xr-xlib/beam/fs.sh (renamed from lib/backup/fs.sh)15
-rw-r--r--lib/beam/mysql.sh (renamed from lib/backup/mysql.sh)15
-rwxr-xr-xlib/beam/postgres.sh (renamed from lib/backup/postgres.sh)15
-rw-r--r--lib/beam/s3.sh (renamed from lib/backup/s3.sh)24
-rw-r--r--restore.in26
-rw-r--r--s3.in85
-rw-r--r--s3mount.in37
26 files changed, 711 insertions, 174 deletions
diff --git a/Make.rules b/Make.rules
index 013402b..186de06 100644
--- a/Make.rules
+++ b/Make.rules
@@ -1,3 +1,19 @@
+# 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/>.
+
.in.sh:
$(AM_V_GEN)sed -f $(top_builddir)/build.sed $< > $@
.1in.1:
diff --git a/Makefile.am b/Makefile.am
index f3569b8..8ebd47a 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,39 +1,40 @@
SUBDIRS=. lib examples doc
if COND_S3MOUNT
- S3MOUNT=s3mount
- S3MOUNT_SH=s3mount.sh
+ S3MOUNT=s3
+ S3MOUNT_SH=s3.sh
endif
-noinst_SCRIPTS=build.sed backup.sh restore.sh $(S3MOUNT_SH)
-bin_SCRIPTS=backup-cleaner
-CLEANFILES=backup.sh restore.sh $(S3MOUNT_SH)
+noinst_SCRIPTS=build.sed backup.sh restore.sh cleaner.sh $(S3MOUNT_SH)
+bin_SCRIPTS=beam
+CLEANFILES=beam beam.sh backup.sh restore.sh cleaner.sh $(S3MOUNT_SH)
install-exec-hook:
- for file in backup restore $(S3MOUNT); \
+ test -z "$(DESTDIR)$(libexecdir)" || \
+ $(mkdir_p) "$(DESTDIR)$(libexecdir)"; \
+ for file in backup restore cleaner $(S3MOUNT); \
do \
- test -z "$(DESTDIR)$(bindir)" || \
- $(mkdir_p) "$(DESTDIR)$(bindir)"; \
${INSTALL} $(top_builddir)/$$file.sh \
- $(DESTDIR)$(bindir)/$$file; \
+ $(DESTDIR)$(libexecdir)/beam-$$file; \
done
install-data-hook:
test -z "$(DESTDIR)$(sysconfdir)" || \
$(mkdir_p) "$(DESTDIR)$(sysconfdir)"; \
- if test -f $(DESTDIR)$(sysconfdir)/backup.conf; then :; else \
- ${INSTALL} -m 644 $(top_srcdir)/backup.conf $(DESTDIR)$(sysconfdir);\
+ if test -f $(DESTDIR)$(sysconfdir)/beam.conf; then :; else \
+ ${INSTALL} -m 644 $(top_srcdir)/beam.conf $(DESTDIR)$(sysconfdir);\
fi
uninstall-hook:
- for file in backup restore $(S3MOUNT); \
+ for file in backup restore cleaner $(S3MOUNT); \
do \
- rm -f "$(DESTDIR)$(bindir)/$$file"; \
+ rm -f "$(DESTDIR)$(libexecdir)/beam-$$file"; \
done
-backup.sh restore.sh $(S3MOUNT_SH): build.sed
-EXTRA_DIST=backup.in restore.in backup.conf backup-cleaner s3mount.in
-distuninstallcheck_listfiles=find $(DESTDIR)$(prefix) -type f -not -wholename '$(DESTDIR)$(sysconfdir)/backup.conf'
+beam.sh backup.sh restore.sh cleaner.sh $(S3MOUNT_SH): build.sed
+EXTRA_DIST=beam.in backup.in restore.in beam.conf cleaner.in s3.in
+distuninstallcheck_listfiles=find $(DESTDIR)$(prefix) -type f -not -wholename '$(DESTDIR)$(sysconfdir)/beam.conf'
$(top_builddir)/build.sed: Makefile
$(AM_V_GEN){ \
echo 's|@''SYSCONFDIR''@|${sysconfdir}|g';\
echo 's|@''LIBDIR''@|${libdir}|g'; \
echo 's|@''BINDIR''@|${bindir}|g'; \
+ echo 's|@''LIBEXECDIR''@|${libexecdir}|g'; \
echo 's|@''PACKAGE_BUGREPORT''@|$(PACKAGE_BUGREPORT)|g'; \
echo 's|@''PACKAGE_NAME''@|$(PACKAGE_NAME)|g';\
echo 's|@''PACKAGE_STRING''@|$(PACKAGE_STRING)|g';\
diff --git a/backup.in b/backup.in
index 455acbe..983fd72 100644
--- a/backup.in
+++ b/backup.in
@@ -1,15 +1,32 @@
#! /bin/bash
-# This script creates a backup of this system. For usage instructions,
-# run `backup --help'. For a detailed description of the backup and
-# restore procedures, see /export/backup/snapshot/README.
-
-libdir=@LIBDIR@/backup
+# 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/>.
+
+libdir=@LIBDIR@/beam
set -e
. $libdir/common.sh
set +e
ts=`date +%Y%m%d`;
week=`date +%U`
+if [ "$1" = "--wtf" ]; then
+ wtf $(basename $0) create a backup
+ exit 0
+fi
+
load_config
taroptions="-c -Hpax $backup_tar_options $backup_rsh_command"
@@ -66,7 +83,7 @@ do
case $1 in
-v|--verbose) verbose="$verbose -v";;
-l|--logfile) shift; backup_logfile=$1;;
- -n|--dry-run) dry_run=echo;;
+ -n|--dry-run) dry_run=echo; backup_logfile=;;
-N|--no-logfile) backup_logfile=;;
-h|--help) help;;
-V|--version) print_version;;
@@ -85,10 +102,10 @@ fi
logit "started"
if test -n "$backup_retain_interval" && test $backup_retain_interval -gt 0; then
- backup-cleaner --retain $backup_retain_interval --verbose \
- --suffix .tar.bz2 $backup_archive_dir
- backup-cleaner --retain $backup_retain_interval --verbose \
- --suffix .db $backup_snapshot_dir
+ @LIBEXECDIR@/beam-cleaner --retain $backup_retain_interval $verbose \
+ --suffix .tar.bz2 $backup_archive_dir
+ @LIBEXECDIR@/beam-cleaner --retain $backup_retain_interval $verbose \
+ --suffix .db $backup_snapshot_dir
fi
runhook prologue_hook
@@ -100,7 +117,7 @@ do
${type}_backup $item
done
-trap '' EXIT INT QUIT TERM
+trap - EXIT INT QUIT TERM
runhook epilogue_hook
logit "finished"
diff --git a/backup.conf b/beam.conf
index 4d12eca..ea6c133 100644
--- a/backup.conf
+++ b/beam.conf
@@ -4,7 +4,7 @@
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 backup.conf(5)
+# 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).
@@ -40,9 +40,13 @@ backup_retain_interval=
backup_bucket_name=
# Mountpoint for the raw bucket.
-#backup_mp_s3backer=/mnt/s3backer
+backup_mp_s3backer=/mnt/s3backer
# Mountpoint for the actual file system.
-#backup_mp_s3=/mnt/s3
+backup_mp_s3=/mnt/s3
+
+# Additional options to pass to s3backer. The use of --vhost option
+# is advised if your bucket is located outside of the US region.
+backup_s3backer_options="--vhost"
##########################################################################
# Tar setup.
diff --git a/beam.in b/beam.in
new file mode 100644
index 0000000..187cc13
--- /dev/null
+++ b/beam.in
@@ -0,0 +1,58 @@
+#! /bin/bash
+
+libdir=@LIBDIR@/bbe
+set -e
+. $libdir/common.sh
+set +e
+
+help() {
+ cat <<EOT
+usage: bbe COMMAND [OPTIONS] [ITEM [ITEM...]]
+
+COMMANDS are:
+EOT
+ for cmd in @LIBEXECDIR@/bbe-*
+ do
+ test -x $cmd && $cmd --wtf
+ done
+ wtf help display help page for a particular command
+ echo ""
+ echo "Report bugs to <@PACKAGE_BUGREPORT@>"
+ exit 0
+}
+
+while [ $# -ne 0 ]
+do
+ case $1 in
+ -h|--help) help;;
+ -V|--version) print_version;;
+ --) shift; break;;
+ -*) echo >&2 "$0: unrecognized option $1"; exit 1;;
+ *) break;;
+ esac
+ shift
+done
+
+if [ $# -eq 0 ]; then
+ error "command not specified"
+ abend 1 "try $0 --help for more details"
+fi
+
+if [ $1 = "help" ]; then
+ shift
+ if [ $# -eq 0 ]; then
+ man 1 beam
+ else
+ man 1 beam-$1
+ fi
+ exit $?
+fi
+
+if [ -x @LIBEXECDIR@/beam-$1 ]; then
+ cmd=@LIBEXECDIR@/beam-$1
+ shift
+ $cmd $@
+else
+ error "unknown command"
+ abend 1 "try $0 --help for more details"
+fi
diff --git a/backup-cleaner b/cleaner.in
index 31483c9..c89511f 100755
--- a/backup-cleaner
+++ b/cleaner.in
@@ -1,5 +1,10 @@
#! /bin/sh
+libdir=@LIBDIR@/beam
+set -e
+. $libdir/common.sh
+set +e
+
dir=
suffix=
retainweeks=3
@@ -30,6 +35,7 @@ do
-v|--verbose) verbose=echo;;
-n|--dry-run) dry_run=echo; verbose=echo;;
-h|--help) help;;
+ --wtf) wtf $(basename $0) clean up old files; exit 0;;
--) shift; break;;
-*) echo >&2 "$0: unrecognized option $1"
exit 1;;
diff --git a/configure.ac b/configure.ac
index b8c341a..2592dcd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,6 +1,22 @@
+# This file is part of BEAM -*- autoconf -*-
+# 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/>.
+
AC_PREREQ(2.63)
-AC_INIT(backup, 1.1, gray@gnu.org.ua)
+AC_INIT(beam, 1.1, gray@gnu.org.ua)
AC_CONFIG_SRCDIR(backup.in)
AC_CONFIG_AUX_DIR([build-aux])
AM_INIT_AUTOMAKE([1.11 tar-ustar silent-rules])
@@ -16,6 +32,6 @@ AM_CONDITIONAL([COND_S3MOUNT],[test "$s3_status"=yes])
AC_OUTPUT(Makefile
lib/Makefile
- lib/backup/Makefile
+ lib/beam/Makefile
examples/Makefile
doc/Makefile)
diff --git a/doc/.gitignore b/doc/.gitignore
index a3c168a..772d3c8 100644
--- a/doc/.gitignore
+++ b/doc/.gitignore
@@ -1,3 +1,3 @@
-backup.1
-restore.1
+beam-backup.1
+beam-restore.1
backup.conf.5
diff --git a/doc/Makefile.am b/doc/Makefile.am
index c7d6d3b..6396bd1 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -1,7 +1,12 @@
-man_MANS = backup.conf.5 backup.1 restore.1
-backup.1: backup.1in Makefile
-backup.conf.5: backup.conf.5in Makefile
-restore.1: restore.1in Makefile
-EXTRA_DIST=backup.1in restore.1in backup.conf.5in
-DISTCLEANFILES=backup.conf.5 backup.1 restore.1
+if COND_S3MOUNT
+ S3=beam-s3.1
+endif
+man_MANS = beam.1 beam.conf.5 beam-backup.1 beam-restore.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
+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
include $(top_srcdir)/Make.rules
diff --git a/doc/backup.1in b/doc/beam-backup.1in
index b6087b5..5ddb39a 100644
--- a/doc/backup.1in
+++ b/doc/beam-backup.1in
@@ -1,27 +1,27 @@
-.\" This file is part of backup -*- nroff -*-
+.\" This file is part of BEAM -*- nroff -*-
.\" Copyright (C) 2012 Sergey Poznyakoff
.\"
-.\" Backup is free software; you can redistribute it and/or modify
+.\" 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.
.\"
-.\" Backup is distributed in the hope that it will be useful,
+.\" 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 backup. If not, see <http://www.gnu.org/licenses/>.
+.\" along with BEAM. If not, see <http://www.gnu.org/licenses/>.
.\"
-.TH BACKUP 1 "May 17, 2012" "BACKUP" "Backup User Reference"
+.TH BEAM-BACKUP 1 "May 29, 2012" "BEAM" "BEAM User Reference"
.SH NAME
-backup \- create a back up.
+beam-backup \- create a back up.
.SH SYNOPSIS
-.B backup
+.B beam backup
[\fB\-h\fR] [\fB\-\-help\fR]
-.B backup
+.B beam backup
[\fB\-vnN\fR] [\fB\-\-verbose\fR] [\fB\-l\fR \fIFILE\fR]\
[\fB\-\-logfile\fR \fIFILE\fR]\
[\fB\-\-dry\-run\fR]
@@ -29,10 +29,10 @@ backup \- create a back up.
[\fB\-R\fR \fIN\fR] [\fB\-\-round\fR \fIN\fR] [\fB\-\-week\fR \fIN\fR]
.SH DESCRIPTION
The
-.B backup
-script creates full or incremental backups of file systems and other
+.B beam-backup
+command creates full or incremental backups of file systems and other
objects described in its configuration file
-.BR backup.conf .
+.BR beam.conf .
The configuration file by default is searched in
.BR @SYSCONFDIR@ .
Another location can be specified by setting the environment variable
@@ -65,7 +65,7 @@ configuration variable \fBbackup_items\fR and identify file systems
section
.B BACKUP ITEMS
in
-.BR backup.conf (5),
+.BR beam.conf (5),
for a detailed description.
.TP
.B WEEK
@@ -132,8 +132,10 @@ Log to FILE. This overrides the \fBbackup_logfile\fR configuration
variable.
.TP
\fB\-n\fR, \fB\-\-dry\-run
-Do nothing, print what would have been done. Use this to debug your
-configuration.
+Do nothing, print what would have been done. This option also implies
+.BR \-\-no\-logfile .
+
+Useful to debug your configuration.
.TP
\fB\-N\fR, \fB\-\-no\-logfile
Do not use \fBbackup_logfile\fR variable, log to standard error
@@ -155,6 +157,9 @@ is used.
.TP
\fB\-h\fR, \fB\-\-help\fR
Display a short help summary.
+.TP
+\fB\-V\fR, \fB\-\-version\fR
+Display program version.
.SH EXAMPLES
Usually \fBbackup\fR is started as a cron job. The following
example shows a root crontab designed so as to create full (level 0)
@@ -164,40 +169,41 @@ and level 2 backups on Tuesdays, Thursdays and Saturdays.
.nf
.in +2
# Create one full backup weekly.
-0 3 * * sun backup --round 0 --level 0
+0 3 * * sun beam backup --round 0 --level 0
# Create incremental backups daily.
-0 3 * * mon backup --round 0 --level 1
-0 3 * * tue backup --round 0 --level 2
-0 3 * * wed backup --round 1 --level 1
-0 3 * * thu backup --round 1 --level 2
-0 3 * * fri backup --round 2 --level 1
-0 3 * * sat backup --round 2 --level 2
+0 3 * * mon beam backup --round 0 --level 1
+0 3 * * tue beam backup --round 0 --level 2
+0 3 * * wed beam backup --round 1 --level 1
+0 3 * * thu beam backup --round 1 --level 2
+0 3 * * fri beam backup --round 2 --level 1
+0 3 * * sat beam backup --round 2 --level 2
.in
.fi
.sp
.SH FILES
.TP
-.BR @SYSCONFDIR@/backup.conf
+.BR @SYSCONFDIR@/beam.conf
Default configuration file.
.TP
-.BR @LIBDIR@/backup
-Backup module directory. Whenever a backup item of type \fBT\fR is
-requested, \fBbackup\fR will attempt to load from this directory a
+.BR @LIBDIR@/beam
+Backup module directory. Whenever a beam item of type \fBT\fR is
+requested, \fBbeam\fR will attempt to load from this directory a
file named \fBT.sh\fR. This file provides methods and definitions
necessary to handle that particular item type.
.TP
-.BR @LIBDIR@/backup/common.sh
+.BR @LIBDIR@/beam/common.sh
Settings and definitions shared between
-.BR backup
+.BR beam-backup
and
-.BR restore (1).
+.BR beam-restore (1).
.SH "SEE ALSO"
-.BR restore (1),
-.BR backup.conf (5).
+.BR beam (1),
+.BR beam-restore (1),
+.BR beam.conf (5).
.SH AUTHORS
Sergey Poznyakoff
.SH "BUG REPORTS"
-Report bugs to <gray@gnu.org.ua>.
+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] \""
diff --git a/doc/restore.1in b/doc/beam-restore.1in
index ee88781..0152df5 100644
--- a/doc/restore.1in
+++ b/doc/beam-restore.1in
@@ -1,27 +1,27 @@
-.\" This file is part of backup -*- nroff -*-
+.\" This file is part of BEAM -*- nroff -*-
.\" Copyright (C) 2012 Sergey Poznyakoff
.\"
-.\" Backup is free software; you can redistribute it and/or modify
+.\" 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.
.\"
-.\" Backup is distributed in the hope that it will be useful,
+.\" 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 backup. If not, see <http://www.gnu.org/licenses/>.
+.\" along with BEAM. If not, see <http://www.gnu.org/licenses/>.
.\"
-.TH RESTORE 1 "May 17, 2012" "RESTORE" "Backup User Reference"
+.TH BEAM-RESTORE 1 "May 29, 2012" "BEAM" "BEAM User Reference"
.SH NAME
-restore \- restore file system from a backup.
+beam-restore \- restore file system from a backup.
.SH SYNOPSIS
-.B restore
+.B beam restore
[\fB\-h\fR] [\fB\-\-help\fR]
-.B restore
+.B beam restore
[\fB\-cntv\fR] [\fB\-\-confirm\fR] [\fB\-C\fR \fIDIR\fR]\
[\fB\-\-directory\fR \fIDIR\fR] [\fB\-\-verbose\fR]
[\fB\-\-dry\-run\fR] [\fB\-\-list\fR] [\fB\-\-logfile\fR \fIFILE\fR]\
@@ -30,13 +30,13 @@ restore \- restore file system from a backup.
[\fBITEM\fR [\fBITEM\fR...]]
.SH DESCRIPTION
The
-.B restore
-utility restores the file system from incremental backups created
+.B beam-restore
+command restores the file system from incremental backups created
using
-.BR backup (1).
+.BR beam "" backup (1).
.PP
The program reads its configuration from the file
-.B backup.conf
+.B beam.conf
located in the
.B @SYSCONFDIR@
directory, or from the file named in the environment variable
@@ -50,12 +50,12 @@ detail in the section
below.
.PP
Once the configuration loaded, the
-.B restore
-utility determines which backup archives to use for restoring. Unless
+.B beam-restore
+command determines which backup archives to use for restoring. Unless
being requested otherwise by the command line options, the utility
selects the most recent set of backup files.
.PP
-Before starting the restore, the utility displays the backup files it
+Before starting the restore, the command displays the backup files it
has selected and asks the user if he wishes to proceed. Empty line
(the \fBCR\fR alone) or any word beginning with \fBY\fR
(case-insensitive) is taken as affirmative. Otherwise, a negative
@@ -100,30 +100,34 @@ Use archives from week \fIN\fR.
.TP
\fB\-h\fR, \fB\-\-help\fR
Display a short help summary.
+.TP
+\fB\-V\fR, \fB\-\-version\fR
+Display program version.
.SH EXAMPLES
.SH FILES
.TP
-.BR @SYSCONFDIR@/backup.conf
+.BR @SYSCONFDIR@/beam.conf
Default configuration file.
.TP
-.BR @LIBDIR@/backup
+.BR @LIBDIR@/beam
Backup module directory. Whenever a backup item of type \fBT\fR is
requested, \fBrestore\fR will attempt to load from this directory a
file named \fBT.sh\fR. This file provides methods and definitions
necessary to handle that particular item type.
.TP
-.BR @LIBDIR@/backup/common.sh
+.BR @LIBDIR@/beam/common.sh
Settings and definitions shared between
-.BR backup (1)
+.BR beam-backup (1)
and
-.BR restore.
+.BR beam-restore.
.SH "SEE ALSO"
-.BR backup (1),
-.BR backup.conf (5)
+.BR beam (1),
+.BR beam-backup (1),
+.BR beam.conf (5)
.SH AUTHORS
Sergey Poznyakoff
.SH "BUG REPORTS"
-Report bugs to <gray@gnu.org.ua>.
+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] \""
diff --git a/doc/beam-s3.1in b/doc/beam-s3.1in
new file mode 100644
index 0000000..1779a9a
--- /dev/null
+++ b/doc/beam-s3.1in
@@ -0,0 +1,87 @@
+.\" 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-S3 1 "May 28, 2012" "BBE" "BBE User Reference"
+.SH NAME
+beam-s3 \- manage a backup s3 bucket
+.SH SYNOPSIS
+.B beam s3
+mount
+
+.B beam s3
+umount
+
+.B beam s3
+status
+
+.B beam s3
+[\fB\-h\fR] [\fB\-\-help\fR] [\fB\-V\fR] [\fB\-\-version\fR]
+.SH DESCRIPTION
+The
+.B beam-s3
+command mounts or unmounts the \fBs3\fR bucket configured by the
+.B backup_bucket_name
+variable in
+.BR beam.conf (5).
+.SH ARGUMENTS
+.TP
+.B mount
+Mount the bucket.
+.TP
+.BR umount , unmount
+Unmount the bucket.
+.TP
+.B status
+Show bucket status.
+.SH OPTIONS
+For consistency with other programs, the following options are understood:
+.TP
+\fB\-h\fR, \fB\-\-help\fR
+Display a short help summary.
+.TP
+\fB\-V\fR, \fB\-\-version\fR
+Display program version.
+.SH FILES
+.TP
+.BR @SYSCONFDIR@/beam.conf
+Default configuration file.
+.TP
+.BR @LIBDIR@/beam/common.sh
+A library of common
+.B beam
+functions.
+.TP
+.BR @LIBDIR@/beam/s3.sh
+The
+.B s3
+support library.
+.SH "SEE ALSO"
+.BR beam (1),
+.BR beam-backup (1),
+.BR beam-restore (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.1in b/doc/beam.1in
new file mode 100644
index 0000000..de7b9d4
--- /dev/null
+++ b/doc/beam.1in
@@ -0,0 +1,139 @@
+.\" 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 1 "May 29, 2012" "BEAM" "BEAM User Reference"
+.SH NAME
+beam \- a backup manager
+.SH SYNOPSIS
+.B beam
+backup [\fIoptions\fB]
+
+.B beam
+restore [\fIoptions\fB]
+
+.B beam
+s3 [\fIoptions\fB]
+
+.B beam
+help \fICOMMAND\fR
+
+.B beam
+[\fB\-h\fR] [\fB\-\-help\fR] [\fB\-V\fR] [\fB\-\-version\fR]
+.SH DESCRIPTION
+.BR B ackup
+.BR E asy
+.BR A nd
+.BR M anageable
+is a suite of backup programs written in reasonably portable shell language
+with the purpose of making backup process as easy as possible.
+.PP
+All backup operations are controlled by the
+.B beam
+utility, which acts as a dispatcher between programs responsible for
+particular tasks. The actual task is specified as a
+.BR command ,
+i.e. a command verb given as the first argument to the program.
+For example,
+.B beam backup
+creates a backup.
+.PP
+.B Beam
+operates on
+.BR backup " " items.
+An item is a set of files, which should be handled together. The way
+to handle these files during backup or restore is defined by the item
+.B type.
+For example, the basic item type is \fBfs\fR (file system),
+which implies archiving all files comprising the item into a single
+.BR tar (1)
+archive. There are special item types for MySQL and PostgreSQL
+databases, etc.
+.PP
+.B Beam
+is a modular system. New item types can easily be defined by
+providing a module which defines how they should be handled during
+backup and restore. A module is a shell script named after the item
+type and placed in the
+.B @LIBDIR@/beam
+directory.
+.PP
+The backup process is controlled by the configuration file
+.BR @SYSCONFDIR@/beam.conf .
+This file is a set of shell variable assingments which define the
+items to include in the backup.
+.PP
+For a detailed description of
+.B beam
+configuration file, backup item definitions and module system, see
+.BR beam.conf (5).
+.SH COMMANDS
+.TP
+.B backup
+Create a backup. See
+.BR beam-backup (1).
+.TP
+.B restore
+Restore files from backup. See
+.BR beam-restore (1).
+.TP
+.B s3
+Mount or unmount a backup s3 bucket. This command is available only
+if
+.B beam
+was configured with the
+.B \-\-with-s3
+option. See
+.BR beam-s3 (1).
+.TP
+.BR help " " \fIcommand\fR
+Display help page for a particular \fIcommand\fR.
+.SH OPTIONS
+.TP
+\fB\-h\fR, \fB\-\-help\fR
+Display a short help summary.
+.TP
+\fB\-V\fR, \fB\-\-version\fR
+Display program version.
+.SH FILES
+.TP
+.B @SYSCONFDIR@/beam.conf
+Default configuration file.
+.TP
+.B @LIBDIR@/beam
+Backup module directory.
+.SH ENVIRONMENT
+.TP
+.B BEAM_CONFIG
+If defined, this variable supplies full pathname of the configuration
+file to use instead of the default
+.BR @SYSCONFDIR@/beam.conf .
+.SH "SEE ALSO"
+.BR beam (1),
+.BR beam-backup (1),
+.BR beam-restore (1),
+.BR beam-s3 (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/backup.conf.5in b/doc/beam.conf.5in
index 5f3c707..cf196e9 100644
--- a/doc/backup.conf.5in
+++ b/doc/beam.conf.5in
@@ -1,24 +1,25 @@
-.\" This file is part of backup -*- nroff -*-
+.\" This file is part of BEAM -*- nroff -*-
.\" Copyright (C) 2012 Sergey Poznyakoff
.\"
-.\" Backup is free software; you can redistribute it and/or modify
+.\" 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.
.\"
-.\" Backup is distributed in the hope that it will be useful,
+.\" 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 backup. If not, see <http://www.gnu.org/licenses/>.
+.\" along with BEAM. If not, see <http://www.gnu.org/licenses/>.
.\"
-.TH BACKUP.CONF 1 "May 16, 2012" "BACKUP.CONF" "Backup User Reference"
+.TH BEAM.CONF 1 "May 16, 2012" "BEAM" "BEAM User Reference"
.SH NAME
-backup.conf \- configuration file for backup system
+beam.conf \- configuration file for
+.B backup becomes easy
.SH DESCRIPTION
-The \fBbackup.conf\fR configuration file defines what files are to be
+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
.BR backup (1)
@@ -63,6 +64,14 @@ bucket you will need the
.BR s3backer (1)
utility.
.TP
+.B backup_s3backer_options
+Additional options for
+.BR s3backer (1).
+
+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
Sets the name of the
.B s3
@@ -256,13 +265,14 @@ system_files="etc home"
.fi
.sp
.SH "SEE ALSO"
-.BR restore (1),
-.BR backup (1),
-.BR backup-cleaner (1).
+.BR beam (1),
+.BR beam-restore (1),
+.BR beam-backup (1),
+.BR beam-cleaner (1).
.SH AUTHORS
Sergey Poznyakoff
.SH "BUG REPORTS"
-Report bugs to <gray@gnu.org.ua>.
+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] \""
diff --git a/lib/Makefile.am b/lib/Makefile.am
index b26ee9a..20a50e8 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -1 +1 @@
-SUBDIRS=backup \ No newline at end of file
+SUBDIRS=beam
diff --git a/lib/backup/Makefile.am b/lib/backup/Makefile.am
deleted file mode 100644
index d1f687d..0000000
--- a/lib/backup/Makefile.am
+++ /dev/null
@@ -1,15 +0,0 @@
-libbackupdir=$(libdir)/backup
-libbackup_SCRIPTS=\
- common.sh\
- s3.sh\
- fs.sh\
- mysql.sh\
- postgres.sh
-EXTRA_DIST=\
- common.in\
- s3.sh\
- fs.sh\
- mysql.sh\
- postgres.sh
-DISTCLEANFILES=common.sh
-include $(top_srcdir)/Make.rules
diff --git a/lib/backup/.gitignore b/lib/beam/.gitignore
index 5621a6e..5621a6e 100644
--- a/lib/backup/.gitignore
+++ b/lib/beam/.gitignore
diff --git a/lib/beam/Makefile.am b/lib/beam/Makefile.am
new file mode 100644
index 0000000..d490acb
--- /dev/null
+++ b/lib/beam/Makefile.am
@@ -0,0 +1,31 @@
+# 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/>.
+
+libbackupdir=$(libdir)/beam
+libbackup_SCRIPTS=\
+ common.sh\
+ s3.sh\
+ fs.sh\
+ mysql.sh\
+ postgres.sh
+EXTRA_DIST=\
+ common.in\
+ s3.sh\
+ fs.sh\
+ mysql.sh\
+ postgres.sh
+DISTCLEANFILES=common.sh
+include $(top_srcdir)/Make.rules
diff --git a/lib/backup/common.in b/lib/beam/common.in
index 11cb2d0..49b41eb 100644
--- a/lib/backup/common.in
+++ b/lib/beam/common.in
@@ -1,4 +1,19 @@
#! /bin/bash
+# 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/>.
# Force C locale
LC_ALL=C
@@ -44,11 +59,11 @@ tarcode() {
load_config() {
local delayed_exit
- test -z "$BACKUP_CONFIG" && BACKUP_CONFIG=@SYSCONFDIR@/backup.conf
- if [ -r $BACKUP_CONFIG ]; then
- . $BACKUP_CONFIG
+ test -z "$BEAM_CONFIG" && BEAM_CONFIG=@SYSCONFDIR@/beam.conf
+ if [ -r $BEAM_CONFIG ]; then
+ . $BEAM_CONFIG
else
- abend 1 "configuration file $BACKUP_CONFIG does not exist or is unreadable"
+ abend 1 "configuration file $BEAM_CONFIG does not exist or is unreadable"
fi
if [ -z "$backup_items" ]; then
@@ -85,7 +100,7 @@ $type"
tar_suffix=${backup_suffix:-.tar}
if [ -n "$backup_bucket_name" ]; then
- . @LIBDIR@/backup/s3.sh
+ . @LIBDIR@/beam/s3.sh
prologue_hook="$prologue_hook s3_mount"
fi
}
@@ -101,12 +116,20 @@ runhook() {
}
print_version() {
- cat <<EOF
-$0 (@PACKAGE_NAME@) @PACKAGE_VERSION@
+ name=$(basename $0)
+ cat <<EOF
+$name (@PACKAGE_NAME@) @PACKAGE_VERSION@
Copyright (C) 2012 Sergey Poznyakoff
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
EOF
- exit 0
-} \ No newline at end of file
+ exit 0
+}
+
+wtf() {
+ l=`echo "${1#beam-}"|sed "s|.|.|g"`
+ s=$(echo " " | sed "s|$l|${1#beam-}|")
+ shift
+ echo " $s $@"
+}
diff --git a/lib/backup/fs.sh b/lib/beam/fs.sh
index 2ac9ad1..6d7d4c7 100755
--- a/lib/backup/fs.sh
+++ b/lib/beam/fs.sh
@@ -1,4 +1,19 @@
#! /bin/bash
+# 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/>.
# initdb item
# Initializes snapshot for the given basename.
diff --git a/lib/backup/mysql.sh b/lib/beam/mysql.sh
index 5538ea8..c33adb0 100644
--- a/lib/backup/mysql.sh
+++ b/lib/beam/mysql.sh
@@ -1,4 +1,19 @@
#! /bin/bash
+# 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/>.
# mysql_check item
mysql_check() {
diff --git a/lib/backup/postgres.sh b/lib/beam/postgres.sh
index f233615..0072da6 100755
--- a/lib/backup/postgres.sh
+++ b/lib/beam/postgres.sh
@@ -1,4 +1,19 @@
#! /bin/bash
+# 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/>.
# postgres_check item
postgres_check() {
diff --git a/lib/backup/s3.sh b/lib/beam/s3.sh
index e463e76..5f7235c 100644
--- a/lib/backup/s3.sh
+++ b/lib/beam/s3.sh
@@ -1,3 +1,19 @@
+# This file is part of BEAM -*- shell-script -*-
+# 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/>.
+
# The configuration variable "backup_bucket_name" must contain the name
# of the s3 bucket to use.
@@ -21,7 +37,7 @@ s3_mount() {
set -- $(mount -tfuse.s3backer |
awk '/https?:\/\/'$backup_bucket_name'/ { print $3 }')
if test -z "$1"; then
- $dry_run s3backer --accessFile=/root/.s3backer_passwd --vhost \
+ $dry_run s3backer $backup_s3backer_options \
$backup_bucket_name $backup_mp_s3backer ||
abend 1 "unable to mount $backup_bucket_name"
umount_list="$backup_mp_s3backer"
@@ -31,9 +47,9 @@ s3_mount() {
set -- $(mount | grep "^${backup_mp_s3backer}/file" | awk '{ print $3 }')
if test -z "$1"; then
case $(basename $0) in
- restore) mountopt=",ro";;
- backup) mountopt=",rw,data=writeback";;
- s3mount) ;;
+ beam-restore|restore) mountopt=",ro";;
+ beam-backup|backup) mountopt=",rw,data=writeback";;
+ beam-s3) ;;
*) error "called as $0: assuming default mount options"
esac
# NOTE: For ext4 add the journal_async_commit option.
diff --git a/restore.in b/restore.in
index 7466a4f..933a260 100644
--- a/restore.in
+++ b/restore.in
@@ -1,10 +1,30 @@
#! /bin/bash
-
-libdir=@LIBDIR@/backup
+# 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/>.
+
+libdir=@LIBDIR@/beam
set -e
. $libdir/common.sh
set +e
+if [ "$1" = "--wtf" ]; then
+ wtf $(basename $0) create a backup
+ exit 0
+fi
+
load_config
taroptions="$backup_tar_options $backup_rsh_command"
@@ -137,7 +157,7 @@ do
${type}_restore $item
done
-trap '' EXIT INT QUIT TERM
+trap - EXIT INT QUIT TERM
runhook epilogue_hook
logit "finished"
diff --git a/s3.in b/s3.in
new file mode 100644
index 0000000..57d53a3
--- /dev/null
+++ b/s3.in
@@ -0,0 +1,85 @@
+#! /bin/bash
+# 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/>.
+
+set -e
+. @LIBDIR@/beam/common.sh
+set +e
+
+if [ "$1" = "--wtf" ]; then
+ wtf $(basename $0) mount or unmount a backup s3 bucket
+ exit 0
+fi
+
+test -z "$BEAM_CONFIG" && BEAM_CONFIG=@SYSCONFDIR@/beam.conf
+
+if [ ! -r $BEAM_CONFIG ]; then
+ echo >&2 "$0: configuration file $BEAM_CONFIG is not found or is unreadable"
+ exit 1
+fi
+
+. $BEAM_CONFIG
+. @LIBDIR@/beam/s3.sh
+
+if [ -z "$backup_bucket_name" ]; then
+ echo >&2 "$0: backup_bucket_name is not defined (examine $BEAM_CONFIG)"
+ exit 1
+fi
+
+help() {
+ cat <<EOT
+usage: beam s3 [OPTIONS]
+ or: beam s3 {mount|umount|status}
+$0 mounts or unmounts a backup s3 bucket, as configured in $BEAM_CONFIG
+
+OPTIONS:
+ -V, --version print program version and exit
+ -h, --help produce this help list
+
+Valid ITEMs are: $backup_items
+
+Report bugs to <@PACKAGE_BUGREPORT@>
+EOT
+ exit 0
+}
+
+while [ $# -ne 0 ]
+do
+ case $1 in
+ -h|--help) help;;
+ -V|--version) print_version;;
+ *) break;;
+ esac
+done
+
+case $1 in
+mount)
+ s3_mount
+ echo "$backup_bucket_name mounted under $backup_mp_s3";;
+umount|unmount)
+ s3_unmount;;
+status)
+ for id in s3 backer
+ do
+ mpoint=$(s3_getmpoint $id)
+ if [ -n "$mpoint" ]; then
+ echo "$id is mounted on $mpoint"
+ fi
+ done;;
+
+*) help
+ exit 1;;
+esac
diff --git a/s3mount.in b/s3mount.in
deleted file mode 100644
index c6e5083..0000000
--- a/s3mount.in
+++ /dev/null
@@ -1,37 +0,0 @@
-#! /bin/bash
-set -e
-test -z "$BACKUP_CONFIG" && BACKUP_CONFIG=@SYSCONFDIR@/backup.conf
-
-if [ ! -r $BACKUP_CONFIG ]; then
- echo >&2 "$0: configuration file $BACKUP_CONFIG is not found or is unreadable"
- exit 1
-fi
-
-. @LIBDIR@/backup/common.sh
-. $BACKUP_CONFIG
-. @LIBDIR@/backup/s3.sh
-
-if [ -z "$backup_bucket_name" ]; then
- echo >&2 "$0: backup_bucket_name is not defined (examine $BACKUP_CONFIG)"
- exit 1
-fi
-
-case $1 in
-start)
- s3_mount
- echo "$backup_bucket_name mounted under $backup_mp_s3";;
-stop)
- s3_unmount;;
-status)
- for id in s3 backer
- do
- mpoint=$(s3_getmpoint $id)
- if [ -n "$mpoint" ]; then
- echo "$id is mounted on $mpoint"
- fi
- done;;
-
-*)
- echo "$0 mounts or unmounts a backup s3 bucket, as configured in $BACKUP_CONFIG"
- echo "usage: $0 start|stop"
-esac

Return to:

Send suggestions and report system problems to the System administrator.