Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
TeDomum
Documentation
Commits
7fb29249
Commit
7fb29249
authored
Apr 25, 2020
by
kaiyou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improve the db checkpoint scripts
parent
a70f5b27
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
5 deletions
+4
-5
config/mysql_checkpoint.sh
config/mysql_checkpoint.sh
+1
-2
config/pgsql_checkpoint.sh
config/pgsql_checkpoint.sh
+3
-3
No files found.
config/mysql_checkpoint.sh
View file @
7fb29249
...
@@ -3,11 +3,10 @@
...
@@ -3,11 +3,10 @@
PROJECTDIR
=
$1
PROJECTDIR
=
$1
BASEDIR
=
${
2
:-
.
}
BASEDIR
=
${
2
:-
.
}
SERVICE
=
${
3
:-
db
}
SERVICE
=
${
3
:-
db
}
BACKUP
=
$(
date
+%s
)
cd
$PROJECTDIR
cd
$PROJECTDIR
docker-compose stop
$SERVICE
docker-compose stop
$SERVICE
rm
$BASEDIR
/wal/
*
rm
$BASEDIR
/wal/
*
tar
-zcf
$BASEDIR
/wal/
$
BACKUP
.tar.gz
$BASEDIR
/db
tar
-zcf
$BASEDIR
/wal/
$
(
date
+%s
)
.tar.gz
$BASEDIR
/db
docker-compose up
-d
$SERVICE
docker-compose up
-d
$SERVICE
ls
-lah
$BASEDIR
/wal
ls
-lah
$BASEDIR
/wal
\ No newline at end of file
config/pgsql_checkpoint.sh
View file @
7fb29249
...
@@ -4,10 +4,10 @@ PROJECTDIR=$1
...
@@ -4,10 +4,10 @@ PROJECTDIR=$1
USER
=
$2
USER
=
$2
BASEDIR
=
${
3
:-
.
}
BASEDIR
=
${
3
:-
.
}
SERVICE
=
${
4
:-
db
}
SERVICE
=
${
4
:-
db
}
BACKUP
=
$(
date
+%s
)
cd
$PROJECTDIR
cd
$PROJECTDIR
rm
-rf
$(
find
$BASEDIR
/wal
-mindepth
1
-type
d
)
rm
-rf
$(
find
$BASEDIR
/wal
-mindepth
1
-type
d
)
docker-compose
exec
$SERVICE
pg_basebackup
-D
/wal/
$BACKUP
-l
$BACKUP
-F
t
-z
-P
-U
$USER
docker-compose
exec
$SERVICE
pg_basebackup
-D
/wal/
$(
date
+%s
)
-F
t
-z
-P
-U
$USER
find
$BASEDIR
/wal
-type
f
!
-newer
$BASEDIR
/wal/
*
.
$BACKUP
!
-name
"*.
$BACKUP
"
-exec
rm
{}
\;
current
=
$(
ls
$BASEDIR
/wal |
grep
'backup$'
|
tail
-n
1
)
find
$BASEDIR
/wal
-type
f
!
-newer
$current
!
-name
$current
-exec
rm
{}
\;
ls
-lah
$BASEDIR
/wal
ls
-lah
$BASEDIR
/wal
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment