Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
iml-backup
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
IML Open Source
iml-backup
Commits
09bae785
Commit
09bae785
authored
1 year ago
by
Hahn Axel (hahn)
Browse files
Options
Downloads
Patches
Plain Diff
update detector and ini validation in localdump
parent
89a9d1e9
Branches
Branches containing commit
No related tags found
1 merge request
!129
Db Profiles
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
detector.sh
+2
-0
2 additions, 0 deletions
detector.sh
includes/dbdetect.class.sh
+19
-4
19 additions, 4 deletions
includes/dbdetect.class.sh
includes/jobhelper.sh
+0
-1
0 additions, 1 deletion
includes/jobhelper.sh
localdump.sh
+22
-16
22 additions, 16 deletions
localdump.sh
with
43 additions
and
21 deletions
detector.sh
+
2
−
0
View file @
09bae785
...
...
@@ -66,6 +66,8 @@ test ! "${sFilter}" = "." && ( echo -n "Filter enabled: "; color.echo "blue" "${
dbdetect._wd
"------"
for
config
in
$(
dbdetect.getConfigs |
grep
"
${
sFilter
}
"
)
;
do
dbdetect._wd
"-----
$config
"
dbdetect.validate
$config
if
dbdetect.exists
$config
;
then
color.print
"green"
"FOUND"
;
echo
":
$config
"
if
[
"
$showInfos
"
-gt
"0"
]
;
then
...
...
This diff is collapsed.
Click to expand it.
includes/dbdetect.class.sh
+
19
−
4
View file @
09bae785
...
...
@@ -18,7 +18,9 @@
# ----------------------------------------------------------------------
DBD_BASEDIR
=
plugins/localdump/profiles
declare
-A
DBD_PARAMS
DBD_INI
=
# ----------------------------------------------------------------------
...
...
@@ -68,6 +70,16 @@ function dbdetect.getProfile(){
basename
"
$1
"
|
cut
-d
"_"
-f
1- |
sed
"s,
\.
ini
$,
,"
}
# check if the requirements for a database match
# param string full path of ini file to check
function
dbdetect.validate
(){
local
_config
=
"
${
1
:-
$DBD_INIFILE
}
"
# show errors in profile ini files
ini.validate
"
$_config
"
"
$(
dirname
$0
)
/includes/dbdetect_validate_profile_ini.sh"
0
&&
dbdetect._wd
"OK: Validation of '
$_config
' successful"
}
# check if the requirements for a database match
# param string full path of ini file to check
function
dbdetect.exists
(){
...
...
@@ -77,8 +89,11 @@ function dbdetect.exists(){
local
_found
=
0
# show errors in profile ini files
ini.validate
"
$_config
"
"
$(
dirname
$0
)
/includes/dbdetect_validate_profile_ini.sh"
&&
dbdetect._wd
"Ini validation OK"
if
[
!
-f
"
$_config
"
]
;
then
dbdetect._wd
"ERROR: ini file '
$_config
' does not exist."
return
1
fi
# set file and inisection we read values from
ini.set
"
$_config
"
"detect"
...
...
@@ -183,8 +198,8 @@ function dbdetect.exists(){
# set a profile name
# param string profile name
function
dbdetect.setProfile
(){
PROFILENAME
=
"
${
1
:-
$PROFILENAME
}
"
dbdetect.exists
"
${
DBD_BASEDIR
}
/
${
PROFILENAME
}
.ini"
DBD_INIFILE
=
"
${
DBD_BASEDIR
}
/
${
1
}
.ini
"
dbdetect.exists
"
${
DBD_BASEDIR
}
/
${
1
}
.ini"
}
function
dbdetect.getParams
(){
...
...
This diff is collapsed.
Click to expand it.
includes/jobhelper.sh
+
0
−
1
View file @
09bae785
...
...
@@ -228,7 +228,6 @@ function _j_runHooks(){
_j_runHooks
"
$_hookbase
"
fi
echo
}
# ------------------------------------------------------------
...
...
This diff is collapsed.
Click to expand it.
localdump.sh
+
22
−
16
View file @
09bae785
...
...
@@ -144,10 +144,10 @@
}
# ------------------------------------------------------------
# get a list of existing d
umper script
s
function
get_
servic
es
(){
# get a list of existing d
atabase profile
s
function
get_
database_profil
es
(){
for
config
in
$(
dbdetect.getConfigs
)
;
do
if
dbdetect.exists
$config
;
then
if
dbdetect.exists
"
$config
"
;
then
echo
"
$(
dbdetect.getProfile
$config
)
"
fi
done
...
...
@@ -334,8 +334,8 @@
echo
showhelp
echo
echo
"On this machine working profiles
(see
${
BACKUP_PLUGINDIR
}
)
:"
get_
services |
sed
"s#^# #g"
echo
"
Hint:
On this machine working profiles:"
get_
database_profiles |
nl
echo
exit
1
fi
...
...
@@ -388,22 +388,24 @@
backup
)
if
[
"
$1
"
=
"ALL"
]
||
[
-z
"
$1
"
]
;
then
services
=
$(
get_servic
es
)
echo
AUTO: calling
local
backup scripts
for
all
known servic
es
echo
$services
profiles2run
=
$(
get_database_profil
es
)
echo
AUTO: calling
local
backup scripts
for
all
active profil
es
echo
"
$profiles2run
"
|
nl
echo
else
services
=
$*
profiles2run
=
$*
fi
# ----- GO
# PROFILENAME mysql_localhost_13306
# SERVICENAME mysql
#
for
PROFILENAME
in
$
services
for
PROFILENAME
in
$
profiles2run
do
if
dbdetect.setProfile
"
${
PROFILENAME
}
"
;
then
h2
"START PROFILE [
${
PROFILENAME
}
]"
SERVICENAME
=
$(
dbdetect.getType
"
$PROFILENAME
"
)
BACKUP_PARAMS
=
$(
dbdetect.getParams
)
...
...
@@ -412,8 +414,6 @@
ARCHIVE_DIR
=
$(
_j_getvar
"
${
JOBFILE
}
"
dir-dbarchive
)
/
${
PROFILENAME
}
BACKUP_SCRIPT
=
$(
get_service_script
${
SERVICENAME
}
)
# ----- start service specific script
h2
"START SCRIPT FOR [
${
PROFILENAME
}
] ->
${
SERVICENAME
}
"
# ------ set env
# echo "BACKUP_PARAMS = $BACKUP_PARAMS"
...
...
@@ -438,10 +438,16 @@
else
echo
"SKIP:
$PROFILENAME
"
echo
"SKIP: profile '
$PROFILENAME
' "
# see why it is not active
DBD_DEBUG
=
1
;
dbdetect.setProfile
"
${
PROFILENAME
}
"
;
echo
;
DBD_DEBUG
=
0
fi
# just to have it in the output
dbdetect.validate
done
;;
...
...
@@ -475,8 +481,8 @@
if
!
dbdetect.setProfile
"
${
parService
}
"
;
then
color.echo error
"ERROR: profile [
${
parService
}
] is not known here (or database service is stopped)."
echo
echo
"Existing
servic
es:"
get_
servic
es
echo
"Existing
database profil
es:"
get_
database_profil
es
exit
1
fi
if
[
!
-d
"
${
BACKUP_BASEDIR
}
/
${
parService
}
"
]
;
then
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment