Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
awit-backstep
awit-backstep-traceback
Commits
8f8fb0de
Commit
8f8fb0de
authored
Sep 03, 2021
by
Nigel Kukard
Browse files
Merge branch 'reinforce-configuration' into 'master'
Reinforce configuration See merge request
!43
parents
bd858297
10a02cba
Changes
1
Hide whitespace changes
Inline
Side-by-side
scripts/backstep-traceback-auto
View file @
8f8fb0de
...
...
@@ -56,24 +56,47 @@ if not os.path.exists(CONFIG_FILE):
print
(
"error: backup is not configured."
)
sys
.
exit
(
2
)
config
=
configparser
.
ConfigParser
()
config_default_dict
=
{
"debug_max_load"
:
"20"
,
"max_load"
:
"8"
,
"report_email"
:
"hostmaster@iitsp.net"
,
"zabbix_config"
:
"/etc/zabbix/zabbix_agentd.conf.d/allworldit.conf"
,
"server_path"
:
"backup"
,
"server_key"
:
"/root/.ssh/backupserver_id_rsa"
,
}
config
=
configparser
.
ConfigParser
(
defaults
=
config_default_dict
)
config
.
read
(
CONFIG_FILE
)
bwlimit
=
config
.
get
(
PERIOD
,
"bwlimit"
)
debug_max_load
=
config
.
get
(
PERIOD
,
"debug_max_load"
)
max_load
=
config
.
get
(
PERIOD
,
"max_load"
)
bwlimit
=
config
.
get
int
(
PERIOD
,
"bwlimit"
,
fallback
=
None
)
debug_max_load
=
config
.
get
int
(
PERIOD
,
"debug_max_load"
)
max_load
=
config
.
get
int
(
PERIOD
,
"max_load"
)
report_email
=
config
.
get
(
PERIOD
,
"report_email"
)
server_host
=
config
.
get
(
PERIOD
,
"server_host"
)
server_key
=
config
.
get
(
PERIOD
,
"server_key"
)
if
not
os
.
path
.
exists
(
server_key
):
print
(
"error: "
+
server_key
+
" does not exist."
)
sys
.
exit
(
2
)
server_path
=
config
.
get
(
PERIOD
,
"server_path"
)
server_port
=
config
.
get
(
PERIOD
,
"server_port"
)
server_port
=
config
.
get
int
(
PERIOD
,
"server_port"
)
server_user
=
config
.
get
(
PERIOD
,
"server_user"
)
zabbix_config
=
config
.
get
(
PERIOD
,
"zabbix_config"
)
if
not
os
.
path
.
exists
(
zabbix_config
):
print
(
"error: "
+
zabbix_config
+
" does not exist."
)
sys
.
exit
(
2
)
if
args
.
verbose
:
syncopts
=
[
"--debug"
,
"--max-load="
+
debug_max_load
]
syncopts
=
[
"--debug"
]
syncopts
.
append
(
"--max-load="
+
str
(
debug_max_load
))
else
:
syncopts
=
[
"--max-load="
+
max_load
,
"--quiet"
,
"--bwlimit="
+
bwlimit
]
syncopts
=
[
"--quiet"
]
syncopts
.
append
(
"--max-load="
+
str
(
max_load
))
if
bwlimit
:
if
bwlimit
>
0
:
syncopts
.
append
(
"--bwlimit="
+
str
(
bwlimit
))
for
lv
in
ast
.
literal_eval
(
config
.
get
(
PERIOD
,
"backup_lvs"
)):
if
args
.
only
and
args
.
only
!=
lv
:
...
...
@@ -110,21 +133,15 @@ for lv in ast.literal_eval(config.get(PERIOD, "backup_lvs")):
command_line
.
extend
(
bind_mount_args
)
command_line
.
append
(
'--email-subject="'
+
PERIOD
.
upper
()
+
" "
+
lv
+
'"'
)
command_line
.
append
(
"--email="
+
report_email
)
command_line
.
extend
([
"--port="
+
server_port
,
"--pubkey="
+
server_key
])
command_line
.
append
(
"--port="
+
str
(
server_port
))
command_line
.
append
(
"--pubkey="
+
server_key
)
command_line
.
extend
(
syncopts
)
command_line
.
extend
([
"--zabbix="
+
ZABBIX_ITEM
,
"--zabbix-config="
+
zabbix_config
])
command_line
.
append
(
"--zabbix="
+
ZABBIX_ITEM
)
command_line
.
append
(
"--zabbix-config="
+
zabbix_config
)
command_line
.
append
(
server_user
+
"@"
+
server_host
+
"::"
+
server_path
+
"/"
+
PERIOD
+
"-"
+
VG
+
"-"
+
lv
"{}@{}::{}/{}-{}-{}"
.
format
(
server_user
,
server_host
,
server_path
,
PERIOD
,
VG
,
lv
)
)
EXIT_CODE
=
subprocess
.
call
(
command_line
)
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment