30 lines
708 B
Bash
Executable File
30 lines
708 B
Bash
Executable File
#!/bin/bash
|
|
set -e
|
|
|
|
SCRIPT_DIR=$(dirname "$0")
|
|
source "${SCRIPT_DIR}/utils.sh"
|
|
source "${SCRIPT_DIR}/func.sh"
|
|
source "${SCRIPT_DIR}/vars.sh"
|
|
source "${SCRIPT_DIR}/disk-lvm.sh"
|
|
source "${SCRIPT_DIR}/database-postgresql.sh"
|
|
|
|
readonly DB_BACKUP_JOB_NAME="Database backup"
|
|
readonly DISK_BACKUP_JOB_NAME="Disk backup"
|
|
|
|
# Started background jobs
|
|
declare -A BG_JOBS
|
|
# Successfully completed background jobs
|
|
declare -a COMPLETED_BG_JOBS
|
|
# Failed background jobs
|
|
declare -A FAILED_BG_JOBS
|
|
|
|
backup_start
|
|
info "Preparing for backup"
|
|
prepare_backup_db
|
|
prepare_backup_disk
|
|
|
|
|
|
info "Backing up the database and filesystem in parallel"
|
|
run_in_bg backup_db "$DB_BACKUP_JOB_NAME"
|
|
run_in_bg backup_disk "$DISK_BACKUP_JOB_NAME"
|