aboutsummaryrefslogtreecommitdiff
path: root/backup.in
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org>2014-03-19 07:44:16 +0200
committerSergey Poznyakoff <gray@gnu.org>2014-03-19 07:44:16 +0200
commit22cddd5c61d150584a065c1a5e6963e8e95a43cb (patch)
tree86859e8dc93677226d668cd20a71f805d99181eb /backup.in
parent10d30373c6fdf0dd23f16251fa2302c18b7eef97 (diff)
downloadbeam-22cddd5c61d150584a065c1a5e6963e8e95a43cb.tar.gz
beam-22cddd5c61d150584a065c1a5e6963e8e95a43cb.tar.bz2
Use uniform indentation, add missing copyleft headers, update years.
Diffstat (limited to 'backup.in')
-rw-r--r--backup.in100
1 files changed, 50 insertions, 50 deletions
diff --git a/backup.in b/backup.in
index ca479b1..477b839 100644
--- a/backup.in
+++ b/backup.in
@@ -1,6 +1,6 @@
#! /bin/sh
# This file is part of BEAM
-# Copyright (C) 2012 Sergey Poznyakoff
+# Copyright (C) 2012-2014 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
@@ -23,8 +23,8 @@ ts=`date +%Y%m%d`;
week=`date +%U`
if [ "$1" = "--wtf" ]; then
- wtf $(basename $0) create a backup
- exit 0
+ wtf $(basename $0) create a backup
+ exit 0
fi
load_config
@@ -36,9 +36,9 @@ taroptions="-c -Hpax $backup_tar_options $backup_rsh_command"
# Set it to "-v" to make script verbose
if [ -n "$backup_verbose" ]; then
- verbose=-v
+ verbose=-v
else
- verbose=
+ verbose=
fi
# Set it to "echo" to initiate dry-run mode.
unset dry_run
@@ -54,7 +54,7 @@ round=0
###########################################################
help() {
- cat <<EOF
+ cat <<EOF
usage: $0 [OPTIONS]
makes incremental backup of that system
@@ -71,7 +71,7 @@ OPTIONS:
Report bugs to <@PACKAGE_BUGREPORT@>
EOF
- exit 0
+ exit 0
}
###########################################################
@@ -80,63 +80,63 @@ EOF
while [ $# -ne 0 ]
do
- case $1 in
- -v|--verbose) verbose="$verbose -v";;
- -l|--logfile) shift; backup_logfile=$1;;
- -n|--dry-run) dry_run=echo; backup_logfile=;;
- -N|--no-logfile) backup_logfile=;;
- -h|--help) help;;
- -V|--version) print_version;;
- -L|--level) shift; level=$1;;
- -R|--round) shift; round=$1;;
- --week) shift; week=$1;;
- *) echo >&2 "$0: unrecognized option $1"; exit 1;;
- esac
- shift
+ case $1 in
+ -v|--verbose) verbose="$verbose -v";;
+ -l|--logfile) shift; backup_logfile=$1;;
+ -n|--dry-run) dry_run=echo; backup_logfile=;;
+ -N|--no-logfile) backup_logfile=;;
+ -h|--help) help;;
+ -V|--version) print_version;;
+ -L|--level) shift; level=$1;;
+ -R|--round) shift; round=$1;;
+ --week) shift; week=$1;;
+ *) echo >&2 "$0: unrecognized option $1"; exit 1;;
+ esac
+ shift
done
backup() {
- logit "started"
-
- runhook prologue_hook
- trap "runhook epilogue_hook" EXIT INT QUIT TERM
-
- if test -n "$backup_retain_interval" &&
- test $backup_retain_interval -gt 0; then
- @LIBEXECDIR@/beam-cleaner --retain $backup_retain_interval $verbose \
+ logit "started"
+
+ runhook prologue_hook
+ trap "runhook epilogue_hook" EXIT INT QUIT TERM
+
+ if test -n "$backup_retain_interval" &&
+ test $backup_retain_interval -gt 0; then
+ @LIBEXECDIR@/beam-cleaner --retain $backup_retain_interval $verbose \
${dry_run+--dry-run} --suffix $backup_suffix $backup_archive_dir
- @LIBEXECDIR@/beam-cleaner --retain $backup_retain_interval $verbose \
+ @LIBEXECDIR@/beam-cleaner --retain $backup_retain_interval $verbose \
${dry_run+--dry-run} --suffix .db $backup_snapshot_dir
- fi
-
- for item in $backup_items
- do
- eval type=\$${item}_type
- ${type}_backup $item
- done
-
- trap - EXIT INT QUIT TERM
- runhook epilogue_hook
-
- logit "finished"
+ fi
+
+ for item in $backup_items
+ do
+ eval type=\$${item}_type
+ ${type}_backup $item
+ done
+
+ trap - EXIT INT QUIT TERM
+ runhook epilogue_hook
+
+ logit "finished"
}
umask ${backup_umask:-077}
prologue_hook="beam_lock $prologue_hook"
if [ -n "$backup_logfile" ]; then
- runhook openlog_hook
- exec >>$backup_logfile
- exec 2>&1
+ runhook openlog_hook
+ exec >>$backup_logfile
+ exec 2>&1
fi
if [ -z "$backup_notify_email" ]; then
- backup
+ backup
else
- report=$backup_snapshot_dir/report.$$
- touch $report
- backup 2>&1 | tee $report
- mail_report $report
- rm $report
+ report=$backup_snapshot_dir/report.$$
+ touch $report
+ backup 2>&1 | tee $report
+ mail_report $report
+ rm $report
fi

Return to:

Send suggestions and report system problems to the System administrator.