###########################
#
# * It stores all backup copies in directory '/var/vmail/backup' by default,
-# You can change it in variable $BACKUP_ROOTDIR below.
+# You can change it in variable $BACKUP_ROOTDIR below or via the -b parameter.
#
# * Set correct values for below variables:
#
#------------------------------------------------------------------------------
usage() {
cat <<-EOF
- Usage: ${BASENAME} [-K DAYS|--keep=DAYS] [-d|--debug] [[-v|--verbose] | [-q|--quiet]]] [--nocolor]
+ Usage: ${BASENAME} [-K DAYS|--keep=DAYS] [-b DIR|--backupdir=DIR] [-d|--debug] [[-v|--verbose] | [-q|--quiet]]] [--nocolor]
${BASENAME} [-h|--help]
${BASENAME} [-V|--version]
Options:
-K|--keep DAYS Keep the backup files of the last DAYS. Default: ${KEEP_DAYS} days.
+ -b|--backupdir DIR Set backup directory. Sets backup rootdir to the same. Default today: ${BACKUP_DIR}
-d|--debug Debug output (bash -x).
-v|--verbose Set verbosity on. Mutually exclusive to '--quiet'.
-q|--quiet Quiet execution, only errors and warnings are shown.
shift
shift
;;
+ -b|--backupdir)
+ BACKUP_DIR="$2"
+ BACKUP_ROOTDIR="$2"
+ shift
+ shift
+ ;;
-d|--debug)
DEBUG="y"
shift
local out_sql_tmp_compressed="${TMP_DIR}/${output_sql_compressed}"
local out_sql_tgt="${BACKUP_DIR}/${output_sql}"
local out_sql_tgt_compressed="${BACKUP_DIR}/${output_sql_compressed}"
- local out_sql_tgt_latest="${BACKUP_DIR}/globals-latest.sql.bz2"
+ local out_sql_tgt_latest="${BACKUP_ROOTDIR}/globals-latest.sql.bz2"
local verbose_option=""
if [[ "${VERBOSE}" == "y" ]] ; then
local out_sql_tmp_compressed="${TMP_DIR}/${output_sql_compressed}"
local out_sql_tgt="${BACKUP_DIR}/${output_sql}"
local out_sql_tgt_compressed="${BACKUP_DIR}/${output_sql_compressed}"
- local out_sql_tgt_latest="${BACKUP_DIR}/${db}-latest.sql.bz2"
+ local out_sql_tgt_latest="${BACKUP_ROOTDIR}/${db}-latest.sql.bz2"
local verbose_option=""
if [[ "${VERBOSE}" == "y" ]] ; then