Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
828a59c984 | ||
|
|
ee1b3b23ab |
12
Readme.md
12
Readme.md
@@ -35,6 +35,18 @@ eg:
|
|||||||
|
|
||||||
If `FILE_REPOSITORY_COMPATIBLE` is set to `false` in the borg.backup.file.settings then the file borg name will have `-file` added too. Currently this is not added to stay compatible with older scripts
|
If `FILE_REPOSITORY_COMPATIBLE` is set to `false` in the borg.backup.file.settings then the file borg name will have `-file` added too. Currently this is not added to stay compatible with older scripts
|
||||||
|
|
||||||
|
All below have default values if not set in the main settings file
|
||||||
|
* COMPRESSION: zstd
|
||||||
|
* COMPRESSION_LEVEL: 3
|
||||||
|
* ENCRYPTION: none
|
||||||
|
* FORCE_CHECK: false
|
||||||
|
* KEEP_LAST: 0
|
||||||
|
* KEEP_HOURS: 0
|
||||||
|
* KEEP_DAYS: 7
|
||||||
|
* KEEP_WEEKS: 4
|
||||||
|
* KEEP_MONTHS: 6
|
||||||
|
* KEEP_YEARS: 1
|
||||||
|
|
||||||
All module settings files can have the following prefixed with `SUB_` to override master settings:
|
All module settings files can have the following prefixed with `SUB_` to override master settings:
|
||||||
* SUB_BACKUP_FILE
|
* SUB_BACKUP_FILE
|
||||||
* SUB_COMPRESSION
|
* SUB_COMPRESSION
|
||||||
|
|||||||
@@ -77,6 +77,7 @@ REPOSITORY="${TARGET_SERVER}${TARGET_FOLDER}${BACKUP_FILE}";
|
|||||||
echo "Repository : ${REPOSITORY}";
|
echo "Repository : ${REPOSITORY}";
|
||||||
|
|
||||||
# check compression if given is valid and check compression level is valid if given
|
# check compression if given is valid and check compression level is valid if given
|
||||||
|
OPT_COMPRESSION='';
|
||||||
if [ ! -z "${COMPRESSION}" ]; then
|
if [ ! -z "${COMPRESSION}" ]; then
|
||||||
# valid compression
|
# valid compression
|
||||||
if [ "${COMPRESSION}" = "lz4" ] || [ "${COMPRESSION}" = "zlib" ] || [ "${COMPRESSION}" = "lzma" ] || [ "${COMPRESSION}" = "zstd" ]; then
|
if [ "${COMPRESSION}" = "lz4" ] || [ "${COMPRESSION}" = "zlib" ] || [ "${COMPRESSION}" = "lzma" ] || [ "${COMPRESSION}" = "zstd" ]; then
|
||||||
|
|||||||
@@ -78,14 +78,18 @@ TARGET_FOLDER="";
|
|||||||
BACKUP_FILE="";
|
BACKUP_FILE="";
|
||||||
SUB_BACKUP_FILE="";
|
SUB_BACKUP_FILE="";
|
||||||
# lz4, zstd 1-22 (3), zlib 0-9 (6), lzma 0-9 (6)
|
# lz4, zstd 1-22 (3), zlib 0-9 (6), lzma 0-9 (6)
|
||||||
COMPRESSION="zstd";
|
DEFAULT_COMPRESSION="zstd";
|
||||||
COMPRESSION_LEVEL=3;
|
DEFAULT_COMPRESSION_LEVEL=3;
|
||||||
|
COMPRESSION="";
|
||||||
|
COMPRESSION_LEVEL="";
|
||||||
SUB_COMPRESSION="";
|
SUB_COMPRESSION="";
|
||||||
SUB_COMPRESSION_LEVEL="";
|
SUB_COMPRESSION_LEVEL="";
|
||||||
# encryption settings
|
# encryption settings
|
||||||
ENCRYPTION="none";
|
DEFAULT_ENCRYPTION="none";
|
||||||
|
ENCRYPTION="";
|
||||||
# force check always
|
# force check always
|
||||||
FORCE_CHECK="false";
|
DEFAULT_FORCE_CHECK="false";
|
||||||
|
FORCE_CHECK="";
|
||||||
BACKUP_SET="";
|
BACKUP_SET="";
|
||||||
SUB_BACKUP_SET="";
|
SUB_BACKUP_SET="";
|
||||||
# for database backup only
|
# for database backup only
|
||||||
@@ -113,12 +117,18 @@ OPT_ZABBIX_UNKNOWN_TABLES="";
|
|||||||
# BACKUP SET that includes hour and minute information
|
# BACKUP SET that includes hour and minute information
|
||||||
# IF BACKUP_SET is empty, this is automatically added
|
# IF BACKUP_SET is empty, this is automatically added
|
||||||
# general keep last, if only this is set only last n will be kept
|
# general keep last, if only this is set only last n will be kept
|
||||||
KEEP_LAST=0;
|
DEFAULT_KEEP_LAST=0;
|
||||||
KEEP_HOURS=0;
|
DEFAULT_KEEP_HOURS=0;
|
||||||
KEEP_DAYS=7;
|
DEFAULT_KEEP_DAYS=7;
|
||||||
KEEP_WEEKS=4;
|
DEFAULT_KEEP_WEEKS=4;
|
||||||
KEEP_MONTHS=6;
|
DEFAULT_KEEP_MONTHS=6;
|
||||||
KEEP_YEARS=1;
|
DEFAULT_KEEP_YEARS=1;
|
||||||
|
KEEP_LAST="";
|
||||||
|
KEEP_HOURS="";
|
||||||
|
KEEP_DAYS="";
|
||||||
|
KEEP_WEEKS="";
|
||||||
|
KEEP_MONTHS="";
|
||||||
|
KEEP_YEARS="";
|
||||||
# in the format of nY|M|d|h|m|s
|
# in the format of nY|M|d|h|m|s
|
||||||
KEEP_WITHIN="";
|
KEEP_WITHIN="";
|
||||||
# sub override init to empty
|
# sub override init to empty
|
||||||
@@ -254,6 +264,37 @@ fi;
|
|||||||
|
|
||||||
# read config file
|
# read config file
|
||||||
. "${BASE_FOLDER}${SETTINGS_FILE}";
|
. "${BASE_FOLDER}${SETTINGS_FILE}";
|
||||||
|
# load default settings for fileds not set
|
||||||
|
if [ -z "${COMPRESSION}" ]; then
|
||||||
|
COMPRESSION="${DEFAULT_COMPRESSION}";
|
||||||
|
fi;
|
||||||
|
if [ -z "${COMPRESSION_LEVEL}" ]; then
|
||||||
|
COMPRESSION_LEVEL="${DEFAULT_COMPRESSION_LEVEL}";
|
||||||
|
fi;
|
||||||
|
if [ -z "${ENCRYPTION}" ]; then
|
||||||
|
ENCRYPTION="${DEFAULT_ENCRYPTION}";
|
||||||
|
fi;
|
||||||
|
if [ -z "${FORCE_CHECK}" ]; then
|
||||||
|
FORCE_CHECK="${DEFAULT_FORCE_CHECK}";
|
||||||
|
fi;
|
||||||
|
if [ -z "${KEEP_LAST}" ]; then
|
||||||
|
KEEP_LAST="${DEFAULT_KEEP_LAST}";
|
||||||
|
fi;
|
||||||
|
if [ -z "${KEEP_HOURS}" ]; then
|
||||||
|
KEEP_HOURS="${DEFAULT_KEEP_HOURS}";
|
||||||
|
fi;
|
||||||
|
if [ -z "${KEEP_DAYS}" ]; then
|
||||||
|
KEEP_DAYS="${DEFAULT_KEEP_DAYS}";
|
||||||
|
fi;
|
||||||
|
if [ -z "${KEEP_WEEKS}" ]; then
|
||||||
|
KEEP_WEEKS="${DEFAULT_KEEP_WEEKS}";
|
||||||
|
fi;
|
||||||
|
if [ -z "${KEEP_MONTHS}" ]; then
|
||||||
|
KEEP_MONTHS="${DEFAULT_KEEP_MONTHS}";
|
||||||
|
fi;
|
||||||
|
if [ -z "${KEEP_YEARS}" ]; then
|
||||||
|
KEEP_YEARS="${DEFAULT_KEEP_YEARS}";
|
||||||
|
fi;
|
||||||
# ** SUB LOAD
|
# ** SUB LOAD
|
||||||
# a settings file always end in .settings, replace that with lower case MODULE.settings
|
# a settings file always end in .settings, replace that with lower case MODULE.settings
|
||||||
SETTINGS_FILE_SUB=$(echo "${SETTINGS_FILE}" | sed -e "s/\.settings/\.${MODULE,,}\.settings/");
|
SETTINGS_FILE_SUB=$(echo "${SETTINGS_FILE}" | sed -e "s/\.settings/\.${MODULE,,}\.settings/");
|
||||||
@@ -365,11 +406,13 @@ if [[ -f "${LOG}" && ! -w "${LOG}" ]] || [[ ! -f "${LOG}" && ! -w "${LOG_FOLDER}
|
|||||||
fi;
|
fi;
|
||||||
|
|
||||||
# if ENCRYPTION is empty or not in the valid list fall back to none
|
# if ENCRYPTION is empty or not in the valid list fall back to none
|
||||||
if [ -z "${ENCRYPTION}" ]; then
|
# NOTE This is currently set in default and doesn't need to be set on empty
|
||||||
ENCRYPTION="none";
|
# only ivalid should be checked
|
||||||
|
#if [ -z "${ENCRYPTION}" ]; then
|
||||||
|
# ENCRYPTION="none";
|
||||||
#else
|
#else
|
||||||
# TODO check for invalid encryption string
|
# TODO check for invalid encryption string
|
||||||
fi;
|
#fi;
|
||||||
|
|
||||||
## FUNCTIONS
|
## FUNCTIONS
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user