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 @@
# 2016-11-10 ..... v1.0
# 2017-03-27 ..... added first param for mode backup|restore
# 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 @@
fi
BACKUP_BASEDIR=`_j_getvar ${DIRFILE} "dir-localdumps"`
BACKUP_PLUGINDIR=`dirname $0`/plugins/localdump
# check
if [ -z $BACKUP_BASEDIR ]; then
......@@ -108,11 +110,19 @@
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
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 @@
echo
showhelp
echo
echo services in this folder are:
echo "Known services (see ${BACKUP_PLUGINDIR}):"
get_services
exit 1
fi
......@@ -253,7 +263,7 @@
# ----- check all params
for SERVICENAME in $services
do
BACKUP_SCRIPT=`dirname $0`/localdump_${SERVICENAME}.sh
BACKUP_SCRIPT=$( get_service_script ${SERVICENAME} )
if [ ! -f $BACKUP_SCRIPT ]; then
color error
echo ERROR: parameter $SERVICENAME seems to be wrong.
......@@ -271,7 +281,7 @@
do
BACKUP_TARGETDIR=${BACKUP_BASEDIR}/${SERVICENAME}
BACKUP_SCRIPT=`dirname $0`/localdump_${SERVICENAME}.sh
BACKUP_SCRIPT=$( get_service_script ${SERVICENAME} )
# show_info_backup_target
......@@ -297,7 +307,7 @@
if [ "$mode" = "restore" ]; then
SERVICENAME=$1
BACKUP_TARGETDIR=${BACKUP_BASEDIR}/${SERVICENAME}
BACKUP_SCRIPT=`dirname $0`/localdump_${SERVICENAME}.sh
BACKUP_SCRIPT=$( get_service_script ${SERVICENAME} )
h1 "RESTORE DATABASE"
if [ -z $2 ]; then
......
File moved
File moved
File moved
......@@ -111,7 +111,7 @@ j_requireBinary "mysqldump" 1
j_requireProcess "mysqld|mariadb" 1
if [ ! -d $SOURCE_DIR ]; then
echo "INFO: driectory $SOURCE_DIR doees not exist."
echo "INFO: directory $SOURCE_DIR doees not exist."
rc=$rc+1
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