From af95b8627f0916dda7bb48f839b561959952f5ec Mon Sep 17 00:00:00 2001 From: Frank Brehm Date: Wed, 22 May 2019 15:38:02 +0200 Subject: [PATCH] Bugfixing and version bump of bin/backup_pgsql.sh --- bin/backup_pgsql.sh | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/bin/backup_pgsql.sh b/bin/backup_pgsql.sh index 1c778ce..195ae0f 100755 --- a/bin/backup_pgsql.sh +++ b/bin/backup_pgsql.sh @@ -27,7 +27,7 @@ # * Add crontab job for root user (or whatever user you want): # # # crontab -e -u postgres -# 1 4 * * * bash /path/to/backup_pgsql.sh +# 1 4 * * * bash /path/to/backup_pgsql.sh -q # # * Make sure 'crond' service is running. # @@ -42,7 +42,7 @@ VERBOSE="n" DEBUG="n" QUIET='n' -VERSION="2.3" +VERSION="3.1" # console colors: RED="" @@ -151,7 +151,8 @@ usage() { 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} + -b|--backupdir DIR + Set root backup directory. Default: ${BACKUP_ROOTDIR} -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. @@ -169,8 +170,8 @@ get_options() { local base_dir= set +e - tmp=$( getopt -o K:dvqhV \ - --long keep:,debug,verbose,quiet,nocolor,help,version \ + tmp=$( getopt -o K:b:dvqhV \ + --long keep:,backupdir:,debug,verbose,quiet,nocolor,help,version \ -n "${BASENAME}" -- "$@" ) if [[ $? != 0 ]] ; then echo "" >&2 @@ -192,8 +193,8 @@ get_options() { shift ;; -b|--backupdir) - BACKUP_DIR="$2" BACKUP_ROOTDIR="$2" + BACKUP_DIR="${BACKUP_ROOTDIR}/${YEAR}/${MONTH}/${DAY}" shift shift ;; -- 2.39.5