aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2012-10-30 11:37:46 +0200
committerSergey Poznyakoff <gray@gnu.org.ua>2012-10-30 11:39:59 +0200
commit70f09e06f7f400fa4fbabf0c4fff09cd2208a932 (patch)
tree69d6128e2a09da648d7a81f90d25cd8a1918bfc0 /lib
parentdbd71155f0bb40e435163ddd2c73c991a4f8e787 (diff)
downloadbeam-70f09e06f7f400fa4fbabf0c4fff09cd2208a932.tar.gz
beam-70f09e06f7f400fa4fbabf0c4fff09cd2208a932.tar.bz2
Create database dumps in temporary directory.
* backup.in: Set safe umask. * lib/beam/common.in (backup_tmp_dir): New global variable. * beam.conf: Add backup_tmp_dir variable. * doc/beam.conf.5in: Document new variables. * lib/beam/mysql.sh: Create temporary files in backup_tmp_dir * lib/beam/postgres.sh: Likewise.
Diffstat (limited to 'lib')
-rw-r--r--lib/beam/common.in1
-rwxr-xr-xlib/beam/mysql.sh8
-rwxr-xr-xlib/beam/postgres.sh8
3 files changed, 9 insertions, 8 deletions
diff --git a/lib/beam/common.in b/lib/beam/common.in
index 4c6cd21..1be075e 100644
--- a/lib/beam/common.in
+++ b/lib/beam/common.in
@@ -30,6 +30,7 @@ backup_archive_dir=
backup_snapshot_dir=
backup_verbose=
backup_logfile="/var/log/backup"
+backup_tmp_dir=/tmp
error() {
echo >&2 $0: $*
diff --git a/lib/beam/mysql.sh b/lib/beam/mysql.sh
index 4ce3a88..185fa48 100755
--- a/lib/beam/mysql.sh
+++ b/lib/beam/mysql.sh
@@ -61,9 +61,9 @@ mysql_backup() {
cmd="$cmd --databases"
fi
if [ -z "$dry_run" ]; then
- $cmd $database > $backup_snapshot_dir/$1-$week-$round-$level
+ $cmd $database > $backup_tmp_dir/$1-$week-$round-$level
else
- echo "$cmd $database > $backup_snapshot_dir/$1-$week-$round-$level"
+ echo "$cmd $database > $backup_tmp_dir/$1-$week-$round-$level"
fi
if [ $? -ne 0 ]; then
@@ -73,9 +73,9 @@ mysql_backup() {
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
+ -C $backup_tmp_dir $1-$week-$round-$level
tarcode $?
- $dry_run rm $backup_snapshot_dir/$1-$week-$round-$level
+ $dry_run rm $backup_tmp_dir/$1-$week-$round-$level
fi
}
diff --git a/lib/beam/postgres.sh b/lib/beam/postgres.sh
index 0eba767..b5a9b6e 100755
--- a/lib/beam/postgres.sh
+++ b/lib/beam/postgres.sh
@@ -45,9 +45,9 @@ postgres_backup() {
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
+ su postgres -c "pg_dump $verbose $database" > $backup_tmp_dir/$1-$week-$round-$level
else
- echo "su postgres -c \"pg_dump $verbose $database\" > $backup_snapshot_dir/$1-$week-$round-$level"
+ echo "su postgres -c \"pg_dump $verbose $database\" > $backup_tmp_dir/$1-$week-$round-$level"
fi
if [ $? -ne 0 ]; then
@@ -57,9 +57,9 @@ postgres_backup() {
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
+ -C $backup_tmp_dir $1-$week-$round-$level
tarcode $?
- $dry_run rm $backup_snapshot_dir/$1-$week-$round-$level
+ $dry_run rm $backup_tmp_dir/$1-$week-$round-$level
fi
}

Return to:

Send suggestions and report system problems to the System administrator.