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
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
No related branches found
No related tags found
1 merge request
!129
Db Profiles
Changes
4
Hide 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" "${
...
@@ -66,6 +66,8 @@ test ! "${sFilter}" = "." && ( echo -n "Filter enabled: "; color.echo "blue" "${
dbdetect._wd
"------"
dbdetect._wd
"------"
for
config
in
$(
dbdetect.getConfigs |
grep
"
${
sFilter
}
"
)
;
do
for
config
in
$(
dbdetect.getConfigs |
grep
"
${
sFilter
}
"
)
;
do
dbdetect._wd
"-----
$config
"
dbdetect._wd
"-----
$config
"
dbdetect.validate
$config
if
dbdetect.exists
$config
;
then
if
dbdetect.exists
$config
;
then
color.print
"green"
"FOUND"
;
echo
":
$config
"
color.print
"green"
"FOUND"
;
echo
":
$config
"
if
[
"
$showInfos
"
-gt
"0"
]
;
then
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 @@
...
@@ -18,7 +18,9 @@
# ----------------------------------------------------------------------
# ----------------------------------------------------------------------
DBD_BASEDIR
=
plugins/localdump/profiles
DBD_BASEDIR
=
plugins/localdump/profiles
declare
-A
DBD_PARAMS
declare
-A
DBD_PARAMS
DBD_INI
=
# ----------------------------------------------------------------------
# ----------------------------------------------------------------------
...
@@ -68,6 +70,16 @@ function dbdetect.getProfile(){
...
@@ -68,6 +70,16 @@ function dbdetect.getProfile(){
basename
"
$1
"
|
cut
-d
"_"
-f
1- |
sed
"s,
\.
ini
$,
,"
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
# check if the requirements for a database match
# param string full path of ini file to check
# param string full path of ini file to check
function
dbdetect.exists
(){
function
dbdetect.exists
(){
...
@@ -77,8 +89,11 @@ function dbdetect.exists(){
...
@@ -77,8 +89,11 @@ function dbdetect.exists(){
local
_found
=
0
local
_found
=
0
# show errors in profile ini files
if
[
!
-f
"
$_config
"
]
;
then
ini.validate
"
$_config
"
"
$(
dirname
$0
)
/includes/dbdetect_validate_profile_ini.sh"
&&
dbdetect._wd
"Ini validation OK"
dbdetect._wd
"ERROR: ini file '
$_config
' does not exist."
return
1
fi
# set file and inisection we read values from
# set file and inisection we read values from
ini.set
"
$_config
"
"detect"
ini.set
"
$_config
"
"detect"
...
@@ -183,8 +198,8 @@ function dbdetect.exists(){
...
@@ -183,8 +198,8 @@ function dbdetect.exists(){
# set a profile name
# set a profile name
# param string profile name
# param string profile name
function
dbdetect.setProfile
(){
function
dbdetect.setProfile
(){
PROFILENAME
=
"
${
1
:-
$PROFILENAME
}
"
DBD_INIFILE
=
"
${
DBD_BASEDIR
}
/
${
1
}
.ini
"
dbdetect.exists
"
${
DBD_BASEDIR
}
/
${
PROFILENAME
}
.ini"
dbdetect.exists
"
${
DBD_BASEDIR
}
/
${
1
}
.ini"
}
}
function
dbdetect.getParams
(){
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(){
...
@@ -228,7 +228,6 @@ function _j_runHooks(){
_j_runHooks
"
$_hookbase
"
_j_runHooks
"
$_hookbase
"
fi
fi
echo
}
}
# ------------------------------------------------------------
# ------------------------------------------------------------
...
...
This diff is collapsed.
Click to expand it.
localdump.sh
+
22
−
16
View file @
09bae785
...
@@ -144,10 +144,10 @@
...
@@ -144,10 +144,10 @@
}
}
# ------------------------------------------------------------
# ------------------------------------------------------------
# get a list of existing d
umper script
s
# get a list of existing d
atabase profile
s
function
get_
servic
es
(){
function
get_
database_profil
es
(){
for
config
in
$(
dbdetect.getConfigs
)
;
do
for
config
in
$(
dbdetect.getConfigs
)
;
do
if
dbdetect.exists
$config
;
then
if
dbdetect.exists
"
$config
"
;
then
echo
"
$(
dbdetect.getProfile
$config
)
"
echo
"
$(
dbdetect.getProfile
$config
)
"
fi
fi
done
done
...
@@ -334,8 +334,8 @@
...
@@ -334,8 +334,8 @@
echo
echo
showhelp
showhelp
echo
echo
echo
"On this machine working profiles
(see
${
BACKUP_PLUGINDIR
}
)
:"
echo
"
Hint:
On this machine working profiles:"
get_
services |
sed
"s#^# #g"
get_
database_profiles |
nl
echo
echo
exit
1
exit
1
fi
fi
...
@@ -388,22 +388,24 @@
...
@@ -388,22 +388,24 @@
backup
)
backup
)
if
[
"
$1
"
=
"ALL"
]
||
[
-z
"
$1
"
]
;
then
if
[
"
$1
"
=
"ALL"
]
||
[
-z
"
$1
"
]
;
then
services
=
$(
get_servic
es
)
profiles2run
=
$(
get_database_profil
es
)
echo
AUTO: calling
local
backup scripts
for
all
known servic
es
echo
AUTO: calling
local
backup scripts
for
all
active profil
es
echo
$services
echo
"
$profiles2run
"
|
nl
echo
echo
else
else
services
=
$*
profiles2run
=
$*
fi
fi
# ----- GO
# ----- GO
# PROFILENAME mysql_localhost_13306
# PROFILENAME mysql_localhost_13306
# SERVICENAME mysql
# SERVICENAME mysql
#
#
for
PROFILENAME
in
$
services
for
PROFILENAME
in
$
profiles2run
do
do
if
dbdetect.setProfile
"
${
PROFILENAME
}
"
;
then
if
dbdetect.setProfile
"
${
PROFILENAME
}
"
;
then
h2
"START PROFILE [
${
PROFILENAME
}
]"
SERVICENAME
=
$(
dbdetect.getType
"
$PROFILENAME
"
)
SERVICENAME
=
$(
dbdetect.getType
"
$PROFILENAME
"
)
BACKUP_PARAMS
=
$(
dbdetect.getParams
)
BACKUP_PARAMS
=
$(
dbdetect.getParams
)
...
@@ -411,9 +413,7 @@
...
@@ -411,9 +413,7 @@
BACKUP_TARGETDIR
=
${
BACKUP_BASEDIR
}
/
${
PROFILENAME
}
BACKUP_TARGETDIR
=
${
BACKUP_BASEDIR
}
/
${
PROFILENAME
}
ARCHIVE_DIR
=
$(
_j_getvar
"
${
JOBFILE
}
"
dir-dbarchive
)
/
${
PROFILENAME
}
ARCHIVE_DIR
=
$(
_j_getvar
"
${
JOBFILE
}
"
dir-dbarchive
)
/
${
PROFILENAME
}
BACKUP_SCRIPT
=
$(
get_service_script
${
SERVICENAME
}
)
BACKUP_SCRIPT
=
$(
get_service_script
${
SERVICENAME
}
)
# ----- start service specific script
h2
"START SCRIPT FOR [
${
PROFILENAME
}
] ->
${
SERVICENAME
}
"
# ------ set env
# ------ set env
# echo "BACKUP_PARAMS = $BACKUP_PARAMS"
# echo "BACKUP_PARAMS = $BACKUP_PARAMS"
...
@@ -438,10 +438,16 @@
...
@@ -438,10 +438,16 @@
else
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
fi
# just to have it in the output
dbdetect.validate
done
done
;;
;;
...
@@ -475,8 +481,8 @@
...
@@ -475,8 +481,8 @@
if
!
dbdetect.setProfile
"
${
parService
}
"
;
then
if
!
dbdetect.setProfile
"
${
parService
}
"
;
then
color.echo error
"ERROR: profile [
${
parService
}
] is not known here (or database service is stopped)."
color.echo error
"ERROR: profile [
${
parService
}
] is not known here (or database service is stopped)."
echo
echo
echo
"Existing
servic
es:"
echo
"Existing
database profil
es:"
get_
servic
es
get_
database_profil
es
exit
1
exit
1
fi
fi
if
[
!
-d
"
${
BACKUP_BASEDIR
}
/
${
parService
}
"
]
;
then
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