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
Merge requests
!1
Version 2
Code
Review changes
Check out branch
Download
Patches
Plain diff
Expand sidebar
Merged
Version 2
version-2
into
master
Overview
0
Commits
12
Pipelines
0
Changes
6
Merged
Hahn Axel (hahn)
requested to merge
version-2
into
master
4 years ago
Overview
0
Commits
12
Pipelines
0
Changes
6
go the plugin way:
move localdump_* scripts to ./plugins/db/ subdir
support for multiple transfer/ restore backend tools
Edited
4 years ago
by
Hahn Axel (hahn)
0
0
Merge request reports
Viewing commit
a704e623
Prev
Next
Show latest version
6 files
+
748
−
113
Side-by-side
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
6
a704e623
transfer with multiple backend tools
· a704e623
Hahn Axel (hahn)
authored
4 years ago
plugins/transfer/_template.sh
0 → 100644
+
167
−
0
View file @ a704e623
Edit in single-file editor
Open in Web IDE
#!/bin/bash
# ================================================================================
#
# TRANSFER :: PLUGIN - TEMPLATE
#
# this script will be included in ../../transfer.sh
#
# --------------------------------------------------------------------------------
# ah - Axel Hahn <axel.hahn@iml.unibe.ch>
# 2021-05-19 ah v0.0 INIT ... WIP
# ================================================================================
# --------------------------------------------------------------------------------
# ENV VARS
# export variables that are needed by the backup tool
# --------------------------------------------------------------------------------
# export PASSPHRASE
# --------------------------------------------------------------------------------
# INIT
# --------------------------------------------------------------------------------
function
t_checkRequirements
(){
echo
"DEBUG: function t_checkRequirements"
j_requireUser
"root"
# j_requireBinary "duplicity"
}
# set variables
function
t_setVars
(){
echo
"DEBUG: t_setVars"
}
# --------------------------------------------------------------------------------
# GENERATE PARAMS :: ALL DIRS
# --------------------------------------------------------------------------------
# return a string with default params
# param string param1 of transfer.sh; one of full|inc|auto
# param string param2 of transfer.sh; for auto: date i.e. 3M for 3 monthes
function
t_getParamDefault
(){
echo
"DEBUG: function t_getParamDefault
$*
"
# local _method=
# --- method
# test "$1" = "full" && _method="full"
# test "$1" = "auto" && _method="--full-if-older-than $2"
# echo -n "$_method"
}
# return a cli parameter for a single exlude directory
# param string cache directory for local index files
function
t_getParamCacheDir
(){
if
[
!
-z
"
$1
"
]
;
then
local
sCacheDir
=
"
$1
"
if
[
!
-d
$sCacheDir
]
;
then
mkdir
-p
$sCacheDir
chmod
750
$sCacheDir
fi
echo
--archive-dir
=
$sCacheDir
fi
}
# return a cli parameter for a single exlude directory
# param string exlude pattern
function
t_getParamExlude
(){
# test -z "$1" || echo --exclude-regexp """$*"""
}
# return a cli parameter for a single exlude directory
# param string exlude pattern
function
t_getParamInlude
(){
# test -z "$1" || echo --include-regexp """$*"""
}
# return a cli parameter to use an ssh keyfile
# param string filename if ssh private key file
function
t_getParamSshKey
(){
# test -z "$1" || echo --ssh-options="""-oIdentityFile=$1"""
}
# --------------------------------------------------------------------------------
# ACTIONS :: TRANSFER
# --------------------------------------------------------------------------------
# pre backup actions
# uses global vars from ../../transfer.sh
function
t_cmdPre
(){
# echo TODO PRE actions before starting transfer
}
# post backup actions
# uses global vars from ../../transfer.sh
function
t_cmdPost
(){
# echo TODO POST actions after all transfers
}
# --------------------------------------------------------------------------------
# GENERATE PARAMS :: SINGLE DIR
# --------------------------------------------------------------------------------
# get target url/ directory
# param string directory to backup
function
t_sd_getTarget
(){
# directory based target
j_getFullTarget
"
$1
"
# for host based backup target - remove param:
# j_getFullTarget ""
}
function
t_sd_getCmdBackup
(){
# echo duplicity ${sBackupParams} ${mydir} ${sTarget}
}
# pre backup actions
# uses global vars from ../../transfer.sh
function
t_sd_cmdPre
(){
}
# post backup actions
# uses global vars from ../../transfer.sh
function
t_sd_cmdPost
(){
}
# --------------------------------------------------------------------------------
# VERIFY RETURNCODES
# --------------------------------------------------------------------------------
# init repository
function
t_rcCheckInit
(){
case
$1
in
0
)
color ok
;
echo
"OK - the repository was created."
;;
*
)
color error
;
echo
"Verify output above - returncode of init was
$1
"
;;
esac
color reset
}
# backup files
function
t_rcCheckBackup
(){
case
$1
in
0
)
color ok
;
echo
"OK"
;;
*
)
color error
;
echo
"Backup error - returncode was
$1
"
;;
esac
color reset
}
# repoitory cleanup
function
t_rcCheckCleanup
(){
case
$1
in
0
)
color ok
;
echo
"OK"
;;
*
)
color error
;
echo
"Cleanup error - returncode was
$1
"
;;
esac
color reset
}
# restore files
function
t_rcCheckRestore
(){
case
$1
in
0
)
color ok
;
echo
"OK"
;;
*
)
color error
;
echo
"Restore error - returncode was
$1
"
;;
esac
color reset
}
# --------------------------------------------------------------------------------
Loading