Skip to content
Snippets Groups Projects
Commit bc89e137 authored by Hahn Axel (hahn)'s avatar Hahn Axel (hahn)
Browse files

move localdumps to plugins dir

parent 100a62e1
No related branches found
No related tags found
1 merge request!1Version 2
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
# 2016-11-10 ..... v1.0 # 2016-11-10 ..... v1.0
# 2017-03-27 ..... added first param for mode backup|restore # 2017-03-27 ..... added first param for mode backup|restore
# 2018-02-09 ..... fix: restore-selection of target uses default on return only # 2018-02-09 ..... fix: restore-selection of target uses default on return only
# 2021-05-18 ..... move supported backup types to plugins/localdump/[service].sh
# ====================================================================== # ======================================================================
...@@ -27,6 +28,7 @@ ...@@ -27,6 +28,7 @@
fi fi
BACKUP_BASEDIR=`_j_getvar ${DIRFILE} "dir-localdumps"` BACKUP_BASEDIR=`_j_getvar ${DIRFILE} "dir-localdumps"`
BACKUP_PLUGINDIR=`dirname $0`/plugins/localdump
# check # check
if [ -z $BACKUP_BASEDIR ]; then if [ -z $BACKUP_BASEDIR ]; then
...@@ -108,11 +110,19 @@ ...@@ -108,11 +110,19 @@
echo $*__${BACKUP_DATE} echo $*__${BACKUP_DATE}
} }
# ------------------------------------------------------------
# get name of a service script
# param string name of a service
function get_service_script(){
local _service=$1
ls -1 ${BACKUP_PLUGINDIR}/${_service}.sh 2>/dev/null
}
# ------------------------------------------------------------ # ------------------------------------------------------------
# get a list of existing dumper scripts # get a list of existing dumper scripts
function get_services(){ function get_services(){
ls -1 `dirname $0`/localdump_* | sed "s#`dirname $0`/localdump_##" | sed "s#\.sh##" #ls -1 `dirname $0`/localdump_* | sed "s#`dirname $0`/localdump_##" | sed "s#\.sh##"
ls -1 ${BACKUP_PLUGINDIR}/*.sh | sed "s#${BACKUP_PLUGINDIR}/##" | sed "s#\.sh##" | sort
} }
# ------------------------------------------------------------ # ------------------------------------------------------------
...@@ -227,7 +237,7 @@ ...@@ -227,7 +237,7 @@
echo echo
showhelp showhelp
echo echo
echo services in this folder are: echo "Known services (see ${BACKUP_PLUGINDIR}):"
get_services get_services
exit 1 exit 1
fi fi
...@@ -253,7 +263,7 @@ ...@@ -253,7 +263,7 @@
# ----- check all params # ----- check all params
for SERVICENAME in $services for SERVICENAME in $services
do do
BACKUP_SCRIPT=`dirname $0`/localdump_${SERVICENAME}.sh BACKUP_SCRIPT=$( get_service_script ${SERVICENAME} )
if [ ! -f $BACKUP_SCRIPT ]; then if [ ! -f $BACKUP_SCRIPT ]; then
color error color error
echo ERROR: parameter $SERVICENAME seems to be wrong. echo ERROR: parameter $SERVICENAME seems to be wrong.
...@@ -271,7 +281,7 @@ ...@@ -271,7 +281,7 @@
do do
BACKUP_TARGETDIR=${BACKUP_BASEDIR}/${SERVICENAME} BACKUP_TARGETDIR=${BACKUP_BASEDIR}/${SERVICENAME}
BACKUP_SCRIPT=`dirname $0`/localdump_${SERVICENAME}.sh BACKUP_SCRIPT=$( get_service_script ${SERVICENAME} )
# show_info_backup_target # show_info_backup_target
...@@ -297,7 +307,7 @@ ...@@ -297,7 +307,7 @@
if [ "$mode" = "restore" ]; then if [ "$mode" = "restore" ]; then
SERVICENAME=$1 SERVICENAME=$1
BACKUP_TARGETDIR=${BACKUP_BASEDIR}/${SERVICENAME} BACKUP_TARGETDIR=${BACKUP_BASEDIR}/${SERVICENAME}
BACKUP_SCRIPT=`dirname $0`/localdump_${SERVICENAME}.sh BACKUP_SCRIPT=$( get_service_script ${SERVICENAME} )
h1 "RESTORE DATABASE" h1 "RESTORE DATABASE"
if [ -z $2 ]; then if [ -z $2 ]; then
......
File moved
File moved
File moved
...@@ -111,7 +111,7 @@ j_requireBinary "mysqldump" 1 ...@@ -111,7 +111,7 @@ j_requireBinary "mysqldump" 1
j_requireProcess "mysqld|mariadb" 1 j_requireProcess "mysqld|mariadb" 1
if [ ! -d $SOURCE_DIR ]; then if [ ! -d $SOURCE_DIR ]; then
echo "INFO: driectory $SOURCE_DIR doees not exist." echo "INFO: directory $SOURCE_DIR doees not exist."
rc=$rc+1 rc=$rc+1
fi fi
......
File moved
File moved
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment