Compare commits

...

9 Commits

Author SHA1 Message Date
Clemens Schwaighofer
fa77876440 Update Version ID to 4.2.4 2022-03-31 11:09:11 +09:00
Clemens Schwaighofer
f128b7ebc4 Bug fix for no keep options set check 2022-03-31 11:01:02 +09:00
Clemens Schwaighofer
77977207c8 Change close parameter check to pure string type 2022-03-31 09:21:23 +09:00
Clemens Schwaighofer
c1f6bb443a Fix for close with empty parameter 2022-03-31 09:18:23 +09:00
Clemens Schwaighofer
86b0fa122a Add empty KEEP option for error with -T 2022-03-30 20:27:46 +09:00
Clemens Schwaighofer
32c320be27 Fix close call int compare 2022-03-30 14:48:52 +09:00
Clemens Schwaighofer
500ab01790 Bug fix for unset var in close call 2022-03-30 11:35:19 +09:00
Clemens Schwaighofer
ab58ab3ad0 Update postgresql module version 2022-03-30 09:48:37 +09:00
Clemens Schwaighofer
7767eb58df Override sudo for postgresql in upgrade script 2022-03-30 09:32:57 +09:00
5 changed files with 15 additions and 8 deletions

View File

@@ -11,8 +11,10 @@
# debug and dry run
DEBUG=0;
DRYRUN=0;
PGSQL_SUDO=1;
# options
OPT_REMOTE="";
PGSQL_SUDO_USER="postgres";
# basic settings needed
TARGET_USER="";
TARGET_HOST="";
@@ -27,11 +29,14 @@ MODULE_LIST="file gitea mysql pgsql zabbix"
# basic options
# -c for config file override
# -n for dry run test
while getopts ":c:nd" opt; do
while getopts ":c:snd" opt; do
case "${opt}" in
c|config)
BASE_FOLDER=${OPTARG};
;;
s|nosudo)
PGSQL_SUDO=0;
;;
d|debug)
DEBUG=1;
;;
@@ -96,8 +101,9 @@ for MODULE in ${MODULE_LIST}; do
# .config/borg/security/<postgresql repo id>
# .cache/borg/<postgresql repo id>
CMD_PREFIX="";
if [ "${MODULE}" = "pgsql" ]; then
CMD_PREFIX="sudo -E -u postgres ";
# only sudo to pgsql if sudo is set to true
if [ "${MODULE}" = "pgsql" ] && [ "${PGSQL_SUDO}" = "1" ]; then
CMD_PREFIX="sudo -E -u ${PGSQL_SUDO_USER} ";
fi;
echo "==== REPOSITORY: ${REPOSITORY}";
borg list ${OPT_REMOTE} --format '{archive}{NL}' ${REPOSITORY}|grep -v "${MODULE},"|

View File

@@ -139,6 +139,8 @@ KEEP_INFO="";
# override standard keep for tagged backups
if [ ! -z "${ONE_TIME_TAG}" ]; then
BACKUP_SET="{now:%Y-%m-%dT%H:%M:%S}";
# set empty to avoid problems
KEEP_OPTIONS=("");
else
# build options and info string,
# also flag BACKUP_SET check if hourly is set
@@ -182,7 +184,7 @@ else
fi;
fi;
# abort if KEEP_OPTIONS is empty
if [ -z "${KEEP_OPTIONS}" ]; then
if [ "${#KEEP_OPTIONS[@]}" -eq "0" ]; then
echo "[! $(date +'%F %T')] It seems no KEEP_* entries where set in a valid format.";
exit 1;
fi;
@@ -197,7 +199,6 @@ else
fi;
fi;
# for folders list split set to "#" and keep the old setting as is
_IFS=${IFS};
IFS="#";

View File

@@ -3,7 +3,7 @@
# unset borg settings
unset BORG_BASE_DIR BORG_UNKNOWN_UNENCRYPTED_REPO_ACCESS_IS_OK BORG_RELOCATED_REPO_ACCESS_IS_OK
# error abort without duration and error notice
if [ $1 == 1 ]; then
if [ $# -ge 1 ] && [ "$1" = "1" ]; then
echo "=== [ERROR: $(date +'%F %T')] ==[${MODULE}]====================================>";
else
DURATION=$[ $(date +'%s')-$START ];

View File

@@ -19,7 +19,7 @@ function version {
}
# version for all general files
VERSION="4.1.2";
VERSION="4.2.4";
# borg version and borg comamnd
BORG_VERSION="";

View File

@@ -10,7 +10,7 @@
# set last edit date + time
MODULE="pgsql"
MODULE_VERSION="1.1.1";
MODULE_VERSION="1.2.0";
DIR="${BASH_SOURCE%/*}"