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
a39f6ac0
Commit
a39f6ac0
authored
2 years ago
by
root
Browse files
Options
Downloads
Patches
Plain Diff
Add updater and update logic to install script.
parent
8866e9e7
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
install.sh
+7
-0
7 additions, 0 deletions
install.sh
update.sh
+21
-0
21 additions, 0 deletions
update.sh
with
28 additions
and
0 deletions
install.sh
+
7
−
0
View file @
a39f6ac0
#!/bin/bash
#!/bin/bash
# Check for correct repository path
if
[[
!
-d
/opt/sql-backup
]]
;
if
[[
!
-d
/opt/sql-backup
]]
;
then
then
echo
"ERROR: Could not find sql-backup repository in /opt/sql-backup. Please clone git repository to the"
\
echo
"ERROR: Could not find sql-backup repository in /opt/sql-backup. Please clone git repository to the"
\
...
@@ -9,12 +10,17 @@ else
...
@@ -9,12 +10,17 @@ else
cd
/opt/sql-backup
cd
/opt/sql-backup
fi
fi
# Update repository
bash update.sh
# Check if config.json exists; create from template if not
if
[[
!
-f
./config.json
]]
if
[[
!
-f
./config.json
]]
then
then
echo
"WARN: No configuration file found. Creating one with default values from config_template.json."
echo
"WARN: No configuration file found. Creating one with default values from config_template.json."
cp
./config_template.json ./config.json
cp
./config_template.json ./config.json
fi
fi
# Check for existing systemd unit and replace
if
[[
!
-f
/etc/systemd/system/sql-backup.service
]]
;
if
[[
!
-f
/etc/systemd/system/sql-backup.service
]]
;
then
then
echo
"WARN: existing service file found. Overwriting."
echo
"WARN: existing service file found. Overwriting."
...
@@ -27,4 +33,5 @@ then
...
@@ -27,4 +33,5 @@ then
fi
fi
cp
-r
./service-unit/sql-backup.timer /etc/systemd/system
cp
-r
./service-unit/sql-backup.timer /etc/systemd/system
# enable systemd unit
systemctl
enable
sql-backup.service
systemctl
enable
sql-backup.service
This diff is collapsed.
Click to expand it.
update.sh
0 → 100644
+
21
−
0
View file @
a39f6ac0
#!/usr/bin/bash
#scriptroot=${BASH_SOURCE[0]}
# create temporary directory in home
mkdir
-p
~/tmp
# Switch to Application Directory
cd
/opt/sql-backup
# save settings file
cp
config.json ~/tmp/
# update git repository
git stash
git pull
# restore settings file
cp
-f
~/tmp/config.json
.
# clear temporary directory
rm
-r
~/tmp/
*
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