Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
sql-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
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
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
DBoD
administration
sql-backup
Commits
7eb792a7
Commit
7eb792a7
authored
2 years ago
by
root
Browse files
Options
Downloads
Patches
Plain Diff
Added rsync capabilitie (only local) to script. Destination can be defined via configuration file.
parent
12af4ea9
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
config_template.json
+2
-1
2 additions, 1 deletion
config_template.json
sql-backup.sh
+7
-1
7 additions, 1 deletion
sql-backup.sh
with
9 additions
and
2 deletions
config_template.json
+
2
−
1
View file @
7eb792a7
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
"sqlPass"
:
null
,
"sqlPass"
:
null
,
"dbNames"
:
"all"
,
"dbNames"
:
"all"
,
"backupRoot"
:
"/var/backups/sql/"
,
"backupRoot"
:
"/var/backups/sql/"
,
"backupRetainDays"
:
30
"backupRetainDays"
:
30
,
"rsyncDest"
:
null
}
}
]
]
This diff is collapsed.
Click to expand it.
sql-backup.sh
+
7
−
1
View file @
7eb792a7
...
@@ -37,6 +37,7 @@ if [ $dbNames == 'all' ]; then
...
@@ -37,6 +37,7 @@ if [ $dbNames == 'all' ]; then
fi
fi
backupRoot
=
$(
cat
$configFile
| jq
-r
'.[0].backupRoot'
)
backupRoot
=
$(
cat
$configFile
| jq
-r
'.[0].backupRoot'
)
backupRetainDays
=
$(
cat
$configFile
| jq
-r
'.[0].backupRetainDays'
)
backupRetainDays
=
$(
cat
$configFile
| jq
-r
'.[0].backupRetainDays'
)
rsyncDest
=
$(
cat
$configFile
| jq
-r
'.[0].rsyncDest'
)
today
=
$(
date
+
"%y%m%d"
)
today
=
$(
date
+
"%y%m%d"
)
...
@@ -70,7 +71,7 @@ do
...
@@ -70,7 +71,7 @@ do
continue
continue
fi
fi
backupPath
=
$backupRoot$dbName
backupPath
=
$backupRoot
/
$dbName
mkdir
-p
${
backupPath
}
mkdir
-p
${
backupPath
}
if
[
-z
$sqlPass
]
;
if
[
-z
$sqlPass
]
;
...
@@ -106,3 +107,8 @@ do
...
@@ -106,3 +107,8 @@ do
continue
continue
fi
fi
done
done
if
[
!
-z
$rsyncDest
]
;
then
echo
'INFO: Rsync destination defined. Start rsync.'
rsync
-r
--delete
$backupRoot
$rsyncDest
fi
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