From 4f8c5388b03d30872fde140315dc3a56746403eb Mon Sep 17 00:00:00 2001 From: Jorge Holgado Date: Tue, 26 Jul 2022 16:48:29 +0200 Subject: [PATCH] some changes --- .gitignore | 1 + get_all_pgmetadata.config | 5 +--- get_all_pgmetadata.config.tmpl | 45 ++++++++++++++++++++++++++++++++++ 3 files changed, 47 insertions(+), 4 deletions(-) create mode 100644 .gitignore create mode 100644 get_all_pgmetadata.config.tmpl diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..df30d24 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*config diff --git a/get_all_pgmetadata.config b/get_all_pgmetadata.config index 335f085..1b68c68 100644 --- a/get_all_pgmetadata.config +++ b/get_all_pgmetadata.config @@ -13,10 +13,7 @@ NOW="$(date +%Y%m%d%H%M%S)" # For debugging WAITSEC=10 -# multi-db support, this is auto -#DBNAME="epayments" - -BACKUPDIR="/home/backup/postgre/metadata/${HOSTNAME,,}" +BACKUPDIR="/var/lib/postgres/scripts/get_all_pgmetadata/${HOSTNAME,,}" LOGDIR="${BACKUPDIR}/logs/" # multi-db support, this is auto diff --git a/get_all_pgmetadata.config.tmpl b/get_all_pgmetadata.config.tmpl new file mode 100644 index 0000000..1b68c68 --- /dev/null +++ b/get_all_pgmetadata.config.tmpl @@ -0,0 +1,45 @@ +#!/bin/bash + +#################################### +# cron vars +#################################### +PGDATA=/var/lib/pgsql/12/data +PGDUMP="$(which pg_dump)" +PGDUMP="${PGDUMP} -h 127.0.0.1" + +TODAY="$(date +%Y%m%d)" +NOW="$(date +%Y%m%d%H%M%S)" + +# For debugging +WAITSEC=10 + +BACKUPDIR="/var/lib/postgres/scripts/get_all_pgmetadata/${HOSTNAME,,}" +LOGDIR="${BACKUPDIR}/logs/" + +# multi-db support, this is auto +#FULLMETADATA="${BACKUPDIR}/FULL_${DBNAME}_METADATA.sql" +# multi-db support, this is auto +#DIFFILE="${BACKUPDIR}/FULL_${DBNAME}_METADATA.sql" + +PSQL="$(which psql) -h 127.0.0.1" + +CHANGEFILE=${BACKUPDIR}/$(basename $0 .sh)_changefile_${NOW}.log +DIFFILE=${BACKUPDIR}/$(basename $0 .sh)_changefile_${NOW}.log + +LOGFILE=${LOGDIR}/$(basename $0 .sh)_${NOW}.log +SCRIPTLOG="${LOGFILE}" +ERRFILE=${LOGDIR}/$(basename $0 .sh)_${NOW}.err +SCRIPTLOGERR="${ERRFILE}" + +#################################### +# git usage +#################################### +# for git usage you'll have to create a git repo on the git server +# then import it into the ${BACKUPDIR} so authentication & config is done +# then this script will make `git push` automatically if ISGITREPO=0 + +# set to 0 if git is in place +ISGITREPO=0 +ISGITREPO=1 + +