Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kwabena Antwi-Boasiako
slapos
Commits
7e3123c6
Commit
7e3123c6
authored
Feb 06, 2015
by
Cédric de Saint Martin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5: mariadb import script: kill mysqld process in trap.
parent
f3b00406
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
9 deletions
+10
-9
stack/erp5/buildout.cfg
stack/erp5/buildout.cfg
+3
-3
stack/erp5/instance-mariadb.cfg.in
stack/erp5/instance-mariadb.cfg.in
+1
-0
stack/erp5/instance.cfg.in
stack/erp5/instance.cfg.in
+1
-0
stack/erp5/template/instance-mariadb-resiliency-after-import-script.sh.in
...ate/instance-mariadb-resiliency-after-import-script.sh.in
+5
-6
No files found.
stack/erp5/buildout.cfg
View file @
7e3123c6
...
...
@@ -150,13 +150,13 @@ context =
[mariadb-resiliency-after-import-script]
recipe = slapos.recipe.build:download
url = ${:_profile_base_location_}/template/instance-mariadb-resiliency-after-import-script.sh.in
md5sum =
a4738534a7e0e19af8a6e90e24029cf3
md5sum =
5a300e69a5984cd0e4f5fe91c0c54aac
mode = 755
[template-mariadb]
recipe = slapos.recipe.build:download
url = ${:_profile_base_location_}/instance-mariadb.cfg.in
md5sum =
c78c8a6445a5f67dca35c427ae370d84
md5sum =
f8da9d6bb5da207d3ecadf2bba499616
mode = 640
[template-zope]
...
...
@@ -199,7 +199,7 @@ mode = 640
# XXX: "template.cfg" is hardcoded in instanciation recipe
filename = template.cfg
template = ${:_profile_base_location_}/instance.cfg.in
md5sum =
78aeabeb306178e4716b44ad6605c59c
md5sum =
0d777bfc8377e5b8ddc2e32a10f45b9b
extra-context =
key apache_location apache:location
key aspell_location aspell:location
...
...
stack/erp5/instance-mariadb.cfg.in
View file @
7e3123c6
...
...
@@ -209,6 +209,7 @@ recipe = collective.recipe.template
input = {{ mariadb_resiliency_after_import_script }}
output = ${rootdirectory:srv}/runner-import-restore
mode = 755
dash_location = {{ dash_location }}
[rootdirectory]
recipe = slapos.cookbook:mkdirectory
...
...
stack/erp5/instance.cfg.in
View file @
7e3123c6
...
...
@@ -134,6 +134,7 @@ filename = instance-mariadb.cfg
extra-context =
section parameter_dict dynamic-template-mariadb-parameters
raw coreutils_location {{ coreutils_location }}
raw dash_location {{ dash_location }}
raw dcron_location {{ dcron_location }}
raw findutils_location {{ findutils_location }}
raw gettext_location {{ gettext_location }}
...
...
stack/erp5/template/instance-mariadb-resiliency-after-import-script.sh.in
View file @
7e3123c6
#!
/bin/sh
#!
{{ dash_location }}
# DO NOT RUN THIS SCRIPT ON PRODUCTION INSTANCE
# OR MYSQL DATA WILL BE ERASED.
...
...
@@ -40,12 +40,13 @@ echo "Starting mariadb..."
# XXX hardcoded
$instance_directory/etc/run/mariadb &
mysqld_pid=$!
sleep
15
trap "kill $mysqld_pid" EXIT TERM INT
sleep 30
# If mysql has stopped, abort
if
!
$(
kill
-0
$mysql_pid
2>/dev/null
)
;
then
if !
[ -d /proc/$mysql_pid ]
; then
exit 1
fi
$instance_directory
/etc/run/mariadb_update
>
/dev/null 2>&1
$instance_directory/etc/run/mariadb_update
echo "Importing data..."
# Use latest dump XXX can contain funny characters
...
...
@@ -53,8 +54,6 @@ dump=$(ls -r $mariadb_backup_directory | head -1)
zcat "$mariadb_backup_directory/$dump" | $mysql_executable -u root --socket="$instance_directory/var/run/mariadb.sock"
RESTORE_EXIT_CODE=$?
kill
"
$mysqld_pid
"
if [ $RESTORE_EXIT_CODE -eq 0 ]; then
echo 'Backup restoration successfully completed.'
else
...
...
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