diff options
-rw-r--r-- | backup.in | 5 | ||||
-rw-r--r-- | beam.conf | 3 | ||||
-rw-r--r-- | doc/beam.conf.5in | 13 | ||||
-rw-r--r-- | lib/beam/common.in | 1 | ||||
-rwxr-xr-x | lib/beam/mysql.sh | 8 | ||||
-rwxr-xr-x | lib/beam/postgres.sh | 8 |
6 files changed, 26 insertions, 12 deletions
@@ -121,6 +121,8 @@ backup() { logit "finished" } +umask ${backup_umask:-077} + if [ -n "$backup_logfile" ]; then runhook openlog_hook exec >>$backup_logfile @@ -129,11 +131,8 @@ fi if [ -z "$backup_notify_email" ]; then backup else - u=$(umask) - umask 077 report=$backup_snapshot_dir/report.$$ touch $report - umask $u backup 2>&1 | tee $report mail_report $report rm $report @@ -49,6 +49,9 @@ epilogue_hook= # If zero or empty, backups are retained forever. backup_retain_interval= +# Directory for temporary files +backup_tmp_dir=/tmp + ########################################################################## # S3 configuration. ########################################################################## diff --git a/doc/beam.conf.5in b/doc/beam.conf.5in index c519fef..69277a7 100644 --- a/doc/beam.conf.5in +++ b/doc/beam.conf.5in @@ -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.CONF 5 "October 24, 2012" "BEAM" "BEAM User Reference" +.TH BEAM.CONF 5 "October 30, 2012" "BEAM" "BEAM User Reference" .SH NAME beam.conf \- configuration file for .B BEAM @@ -35,6 +35,17 @@ used by the backup scripts begin with .BR backup_ . .SH GENERAL SETUP .TP +.BR backup_umask = \fIMASK\fR +Sets file mode creation mask. This mask will apply to all files +created during the backup: archives, snapshots and temporary files. +The default mask is +.BR 077 . +.TP +.BR backup_tmp_dir = \fIDIR\fR +Sets the directory where temporary files will be stored. The default +is +.BR /tmp . +.TP .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 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 } |