Skip to content
GitLab
Menu
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
7c9d3e6f
Commit
7c9d3e6f
authored
Sep 03, 2021
by
Robert Spencer
Browse files
Add comand line parameter and code for testing
Signed-off-by:
Robert Spencer
<
rspencer@lbsd.net
>
parent
975fdb84
Changes
1
Hide whitespace changes
Inline
Side-by-side
scripts/backstep-traceback-auto
View file @
7c9d3e6f
...
...
@@ -40,6 +40,12 @@ group.add_argument("-w", "--weekly", action="store_true", help="Do weekly backup
parser
.
add_argument
(
"-o"
,
"--only"
,
help
=
"Only do a backup of the specified lv"
,
metavar
=
"lv_name"
)
parser
.
add_argument
(
"-t"
,
"--test"
,
action
=
"store_true"
,
help
=
"Don't do anything, only show what would have been run."
,
)
args
=
parser
.
parse_args
()
if
args
.
daily
:
...
...
@@ -50,7 +56,10 @@ else:
print
(
"error: You need to specify a period [daily or weekly]."
)
sys
.
exit
(
2
)
CONFIG_FILE
=
"/etc/backstep-traceback/backstep-traceback-auto.ini"
if
not
args
.
test
:
CONFIG_FILE
=
"/etc/backstep-traceback/backstep-traceback-auto.ini"
else
:
CONFIG_FILE
=
"backstep-traceback-auto.ini"
if
not
os
.
path
.
exists
(
CONFIG_FILE
):
print
(
"error: backup is not configured."
)
...
...
@@ -74,18 +83,20 @@ 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
)
if
not
args
.
test
:
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
.
getint
(
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
not
args
.
test
:
if
not
os
.
path
.
exists
(
zabbix_config
):
print
(
"error: "
+
zabbix_config
+
" does not exist."
)
sys
.
exit
(
2
)
if
args
.
verbose
:
syncopts
=
[
"--debug"
]
...
...
@@ -105,12 +116,15 @@ for lv in ast.literal_eval(config.get(PERIOD, "backup_lvs")):
bind_mount_args
=
[]
lvm_snapshot_args
=
[]
if
os
.
path
.
exists
(
"/dev/lvm-raid/"
+
lv
):
VG
=
"lvm-raid"
elif
os
.
path
.
exists
(
"/dev/lvm-cache/"
+
lv
):
VG
=
"lvm-cache"
if
not
args
.
test
:
if
os
.
path
.
exists
(
"/dev/lvm-raid/"
+
lv
):
VG
=
"lvm-raid"
elif
os
.
path
.
exists
(
"/dev/lvm-cache/"
+
lv
):
VG
=
"lvm-cache"
else
:
continue
else
:
continue
VG
=
"lvm-raid"
if
lv
==
"root"
:
bind_mount_args
.
append
(
"--bind-mount"
)
...
...
@@ -149,4 +163,7 @@ for lv in ast.literal_eval(config.get(PERIOD, "backup_lvs")):
)
)
EXIT_CODE
=
subprocess
.
call
(
command_line
)
if
not
args
.
test
:
EXIT_CODE
=
subprocess
.
call
(
command_line
)
else
:
print
(
command_line
)
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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