some changes

This commit is contained in:
Jorge Holgado 2022-07-26 16:48:29 +02:00
parent b3d5ff40f4
commit 4f8c5388b0
Signed by: dodger
GPG Key ID: F6701F6CB4D1C826
3 changed files with 47 additions and 4 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
*config

View File

@ -13,10 +13,7 @@ NOW="$(date +%Y%m%d%H%M%S)"
# For debugging # For debugging
WAITSEC=10 WAITSEC=10
# multi-db support, this is auto BACKUPDIR="/var/lib/postgres/scripts/get_all_pgmetadata/${HOSTNAME,,}"
#DBNAME="epayments"
BACKUPDIR="/home/backup/postgre/metadata/${HOSTNAME,,}"
LOGDIR="${BACKUPDIR}/logs/" LOGDIR="${BACKUPDIR}/logs/"
# multi-db support, this is auto # multi-db support, this is auto

View File

@ -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