Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
297c745df7 | ||
|
|
a2bf6b3331 | ||
|
|
07896af1ae | ||
|
|
8de971b922 | ||
|
|
e7699015c5 | ||
|
|
28dd6cb911 | ||
|
|
ab47692848 | ||
|
|
4267cb5b32 | ||
|
|
f24daba195 |
2
.shellcheckrc
Normal file
2
.shellcheckrc
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
shell=bash
|
||||||
|
external-sources=true
|
||||||
@@ -273,6 +273,8 @@ There are no control files for gitea backup
|
|||||||
|
|
||||||
## zabbix config backup settings
|
## zabbix config backup settings
|
||||||
|
|
||||||
|
The `zabbix-dump` dump script must be installed from: <https://github.com/gullevek/zabbix-backup>
|
||||||
|
|
||||||
### zabbix Config Variables
|
### zabbix Config Variables
|
||||||
|
|
||||||
| Variable | Default | Description |
|
| Variable | Default | Description |
|
||||||
@@ -281,6 +283,7 @@ There are no control files for gitea backup
|
|||||||
| ZABBIX_DATABASE | '' | Must be set as either psql or mysql |
|
| ZABBIX_DATABASE | '' | Must be set as either psql or mysql |
|
||||||
| ZABBIX_CONFIG | '' | if not set uses default location |
|
| ZABBIX_CONFIG | '' | if not set uses default location |
|
||||||
| ZABBIX_UNKNOWN_TABLES | '' | if set, changed to -f (force) |
|
| ZABBIX_UNKNOWN_TABLES | '' | if set, changed to -f (force) |
|
||||||
|
| ZABBIX_DB_PORT | '' | if set, sets -P parameter on zabbix backup script to override auto get from zabbix server config |
|
||||||
|
|
||||||
### zabbix Control files
|
### zabbix Control files
|
||||||
|
|
||||||
|
|||||||
@@ -163,9 +163,11 @@ ZABBIX_DUMP_BIN="";
|
|||||||
ZABBIX_CONFIG="";
|
ZABBIX_CONFIG="";
|
||||||
ZABBIX_DATABASE="";
|
ZABBIX_DATABASE="";
|
||||||
ZABBIX_UNKNOWN_TABLES="";
|
ZABBIX_UNKNOWN_TABLES="";
|
||||||
|
ZABBIX_DB_PORT="";
|
||||||
OPT_ZABBIX_DUMP="";
|
OPT_ZABBIX_DUMP="";
|
||||||
OPT_ZABBIX_CONFIG="";
|
OPT_ZABBIX_CONFIG="";
|
||||||
OPT_ZABBIX_UNKNOWN_TABLES="";
|
OPT_ZABBIX_UNKNOWN_TABLES="";
|
||||||
|
OPT_ZABBIX_DB_PORT="";
|
||||||
# default keep 7 days, 4 weeks, 6 months, 1 year
|
# default keep 7 days, 4 weeks, 6 months, 1 year
|
||||||
# if set 0, ignore/off
|
# if set 0, ignore/off
|
||||||
# note that for last/hourly it is needed to create a different
|
# note that for last/hourly it is needed to create a different
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ if [ -z "${GITEA_WORKING_DIR}" ]; then
|
|||||||
GITEA_WORKING_DIR="/var/tmp/gitea/";
|
GITEA_WORKING_DIR="/var/tmp/gitea/";
|
||||||
fi;
|
fi;
|
||||||
# general temp folder for temporary data storage, this is not working output folder
|
# general temp folder for temporary data storage, this is not working output folder
|
||||||
if [ -z "${GITEA_TEMP_DIR}"]; then
|
if [ -z "${GITEA_TEMP_DIR}" ]; then
|
||||||
GITEA_TEMP_DIR="/var/tmp";
|
GITEA_TEMP_DIR="/var/tmp";
|
||||||
fi;
|
fi;
|
||||||
if [ -z "${GITEA_BIN}" ]; then
|
if [ -z "${GITEA_BIN}" ]; then
|
||||||
|
|||||||
@@ -62,10 +62,11 @@ if [ -z "${_MYSQL_OK}" ]; then
|
|||||||
fi;
|
fi;
|
||||||
# below is for file name only
|
# below is for file name only
|
||||||
# set DB_VERSION (Distrib n.n.n-type)
|
# set DB_VERSION (Distrib n.n.n-type)
|
||||||
# NEW: mysql Ver 15.1 Distrib 10.5.12-MariaDB, for debian-linux-gnu (x86_64) using EditLine wrapper
|
# OLD: mysql Ver 14.14 Distrib 5.7.35, for Linux (x86_64) using EditLine wrapper
|
||||||
# OLD: mysql Ver 14.14 Distrib 5.7.35, for Linux (x86_64) using EditLine wrapper
|
# NEW: mysql Ver 15.1 Distrib 10.5.12-MariaDB, for debian-linux-gnu (x86_64) using EditLine wrapper
|
||||||
|
# VARIANT: mysql from 11.8.3-MariaDB, client 15.2 for debian-linux-gnu (x86_64) using EditLine wrapper
|
||||||
_DB_VERSION_TYPE=$("${MYSQL_CMD}" --version);
|
_DB_VERSION_TYPE=$("${MYSQL_CMD}" --version);
|
||||||
_DB_VERSION=$(echo "${_DB_VERSION_TYPE}" | sed 's/.*Distrib \([0-9]\{1,\}\.[0-9]\{1,\}\)\.[0-9]\{1,\}.*/\1/');
|
_DB_VERSION=$(echo "${_DB_VERSION_TYPE}" | sed 's/.*\(Distrib\|from\) \([0-9]\{1,\}\.[0-9]\{1,\}\)\.[0-9]\{1,\}.*/\2/');
|
||||||
DB_VERSION=$(echo "${_DB_VERSION}" | cut -d " " -f 1);
|
DB_VERSION=$(echo "${_DB_VERSION}" | cut -d " " -f 1);
|
||||||
# temporary until correct type detection is set
|
# temporary until correct type detection is set
|
||||||
DB_TYPE="mysql";
|
DB_TYPE="mysql";
|
||||||
|
|||||||
@@ -40,12 +40,15 @@ COMPACT_INTERVAL="";
|
|||||||
# if set to 1 then every time the script runs
|
# if set to 1 then every time the script runs
|
||||||
# any other value it means ever n days, eg 90 would be every 90 days
|
# any other value it means ever n days, eg 90 would be every 90 days
|
||||||
CHECK_INTERVAL="";
|
CHECK_INTERVAL="";
|
||||||
# default is %Y-%m-%d
|
# default is {now:%Y-%m-%d}
|
||||||
# todays date, if more than one per day add -%H%M for hour/minute
|
# todays date, if more than one per day add -%H%M for hour/minute
|
||||||
# it can also be "{hostname}-{user}-{now:%Y-%m-%dT%H:%M:%S.%f}"
|
# it can also be "{hostname}-{user}-{now:%Y-%m-%dT%H:%M:%S.%f}"
|
||||||
BACKUP_SET="";
|
BACKUP_SET="";
|
||||||
# prune times, how many are kept in each time frame
|
# prune times, how many are kept in each time frame
|
||||||
|
KEEP_LAST="";
|
||||||
|
KEEP_HOURS="";
|
||||||
KEEP_DAYS="";
|
KEEP_DAYS="";
|
||||||
KEEP_WEEKS="";
|
KEEP_WEEKS="";
|
||||||
KEEP_MONTHS="";
|
KEEP_MONTHS="";
|
||||||
KEEP_YEARS="";
|
KEEP_YEARS="";
|
||||||
|
KEEP_WITHIN="";
|
||||||
|
|||||||
@@ -15,3 +15,5 @@ ZABBIX_DATABASE="";
|
|||||||
ZABBIX_CONFIG="";
|
ZABBIX_CONFIG="";
|
||||||
# unknown tables, default ignore, is set to true, will force backup them
|
# unknown tables, default ignore, is set to true, will force backup them
|
||||||
ZABBIX_UNKNOWN_TABLES="";
|
ZABBIX_UNKNOWN_TABLES="";
|
||||||
|
# overide zabbix db port read from zabbix config, if not set read from zabbix config
|
||||||
|
ZABBIX_DB_PORT="";
|
||||||
|
|||||||
@@ -37,6 +37,10 @@ fi;
|
|||||||
if [ "${ZABBIX_DATABASE}" = "psql" ]; then
|
if [ "${ZABBIX_DATABASE}" = "psql" ]; then
|
||||||
OPT_ZABBIX_DUMP="-C";
|
OPT_ZABBIX_DUMP="-C";
|
||||||
fi;
|
fi;
|
||||||
|
OPT_ZABBIX_DB_PORT="";
|
||||||
|
if [ -n "${ZABBIX_DB_PORT}" ]; then
|
||||||
|
OPT_ZABBIX_DB_PORT="-P ${ZABBIX_DB_PORT}";
|
||||||
|
fi;
|
||||||
if [ "${ZABBIX_DATABASE}" != "psql" ] && [ "${ZABBIX_DATABASE}" != "mysql" ]; then
|
if [ "${ZABBIX_DATABASE}" != "psql" ] && [ "${ZABBIX_DATABASE}" != "mysql" ]; then
|
||||||
echo "[! $(date +'%F %T')] Zabbix dump must have database set to either psql or mysql";
|
echo "[! $(date +'%F %T')] Zabbix dump must have database set to either psql or mysql";
|
||||||
. "${DIR}/borg.backup.functions.close.sh" 1;
|
. "${DIR}/borg.backup.functions.close.sh" 1;
|
||||||
@@ -70,13 +74,13 @@ fi;
|
|||||||
|
|
||||||
printf "${PRINTF_SUB_BLOCK}" "BACKUP: zabbix settings" "$(date +'%F %T')" "${MODULE}";
|
printf "${PRINTF_SUB_BLOCK}" "BACKUP: zabbix settings" "$(date +'%F %T')" "${MODULE}";
|
||||||
if [ ${DEBUG} -eq 1 ] || [ ${DRYRUN} -eq 1 ]; then
|
if [ ${DEBUG} -eq 1 ] || [ ${DRYRUN} -eq 1 ]; then
|
||||||
echo "${ZABBIX_DUMP_BIN} -t ${ZABBIX_DATABASE} ${OPT_ZABBIX_UNKNOWN_TABLES} ${OPT_ZABBIX_DUMP} ${OPT_ZABBIX_CONFIG} -o - | ${BORG_CALL}"
|
echo "${ZABBIX_DUMP_BIN} ${OPT_ZABBIX_DB_PORT} -t ${ZABBIX_DATABASE} ${OPT_ZABBIX_UNKNOWN_TABLES} ${OPT_ZABBIX_DUMP} ${OPT_ZABBIX_CONFIG} -o - | ${BORG_CALL}"
|
||||||
if [ -z "${ONE_TIME_TAG}" ]; then
|
if [ -z "${ONE_TIME_TAG}" ]; then
|
||||||
echo "${BORG_PRUNE}";
|
echo "${BORG_PRUNE}";
|
||||||
fi;
|
fi;
|
||||||
fi;
|
fi;
|
||||||
if [ ${DRYRUN} -eq 0 ]; then
|
if [ ${DRYRUN} -eq 0 ]; then
|
||||||
${ZABBIX_DUMP_BIN} -t ${ZABBIX_DATABASE} ${OPT_ZABBIX_UNKNOWN_TABLES} ${OPT_ZABBIX_DUMP} ${OPT_ZABBIX_CONFIG} -o - | ${BORG_CALL};
|
${ZABBIX_DUMP_BIN} ${OPT_ZABBIX_DB_PORT} -t ${ZABBIX_DATABASE} ${OPT_ZABBIX_UNKNOWN_TABLES} ${OPT_ZABBIX_DUMP} ${OPT_ZABBIX_CONFIG} -o - | ${BORG_CALL};
|
||||||
fi;
|
fi;
|
||||||
if [ -z "${ONE_TIME_TAG}" ]; then
|
if [ -z "${ONE_TIME_TAG}" ]; then
|
||||||
printf "${PRINTF_SUB_BLOCK}" "PRUNE" "$(date +'%F %T')" "${MODULE}";
|
printf "${PRINTF_SUB_BLOCK}" "PRUNE" "$(date +'%F %T')" "${MODULE}";
|
||||||
|
|||||||
Reference in New Issue
Block a user