Skip to content

Commit 4c38733

Browse files
Use mysql as service name in docker
1 parent 3a9de05 commit 4c38733

File tree

2 files changed

+50
-18
lines changed

2 files changed

+50
-18
lines changed

config/homebin/vagrant_provision

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,18 @@ else
2929
fi
3030

3131
vvv_info " * Restarting MariaDB service"
32-
if sudo service mariadb status > /dev/null; then
33-
sudo service mariadb restart
32+
if [ ! -f /.dockerenv ]; then
33+
if sudo service mariadb status > /dev/null; then
34+
sudo service mariadb restart
35+
else
36+
sudo service mariadb start
37+
fi
3438
else
35-
sudo service mariadb start
39+
if sudo service mysql status > /dev/null; then
40+
sudo service mysql restart
41+
else
42+
sudo service mysql start
43+
fi
3644
fi
3745

3846
if [ ! -f /.dockerenv ]; then

provision/core/mariadb/provision.sh

Lines changed: 39 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,13 @@ function mysql_setup() {
125125
vvv_info " * Copied /srv/provision/core/mariadb/config/debian.cnf to /etc/mysql/debian.cnf"
126126

127127
# Due to systemd dependencies, in docker, mysql service is not auto started
128+
# also docker isn't systemd based, so thee service name is different: see: https://mariadb.com/kb/en/systemd/ vs https://mariadb.com/kb/en/sysvinit/
128129
vvv_info " * Ensuring MariaDB service is started"
129-
service mariadb status > /dev/null || service mariadb start
130+
if [ ! -f /.dockerenv ]; then
131+
service mariadb status > /dev/null || service mariadb start
132+
else
133+
service mysql status > /dev/null || service mysql start
134+
fi
130135

131136
if [ ! -f /.dockerenv ]; then
132137
check_mysql_root_password
@@ -135,21 +140,40 @@ function mysql_setup() {
135140
# MySQL gives us an error if we restart a non running service, which
136141
# happens after a `vagrant halt`. Check to see if it's running before
137142
# deciding whether to start or restart.
138-
if service mariadb status > /dev/null; then
139-
vvv_info " * Restarting the mariadb service"
140-
if ! service mariadb restart; then
141-
vvv_error " * Restarting the MariaDB failed! Fetching service status."
142-
service mariadb status
143-
exit 1
144-
fi
143+
if [ ! -f /.dockerenv ]; then
144+
if service mariadb status > /dev/null; then
145+
vvv_info " * Restarting the mariadb service"
146+
if ! service mariadb restart; then
147+
vvv_error " * Restarting the MariaDB failed! Fetching service status."
148+
service mariadb status
149+
exit 1
150+
fi
151+
else
152+
vvv_info " * Restarting mariadb service"
153+
service mariadb start
154+
if ! service mariadb start; then
155+
vvv_error " * Starting MariaDB failed! Fetching service status."
156+
service mariadb status
157+
exit 1
158+
fi
159+
fi
145160
else
146-
vvv_info " * Restarting mariadb service"
147-
service mariadb start
148-
if ! service mariadb start; then
149-
vvv_error " * Starting MariaDB failed! Fetching service status."
150-
service mariadb status
151-
exit 1
152-
fi
161+
if service mysql status > /dev/null; then
162+
vvv_info " * Restarting the mariadb service"
163+
if ! service mysql restart; then
164+
vvv_error " * Restarting the MariaDB failed! Fetching service status."
165+
service mysql status
166+
exit 1
167+
fi
168+
else
169+
vvv_info " * Restarting mariadb service"
170+
service mysql start
171+
if ! service mysql start; then
172+
vvv_error " * Starting MariaDB failed! Fetching service status."
173+
service mysql status
174+
exit 1
175+
fi
176+
fi
153177
fi
154178

155179
# IMPORT SQL

0 commit comments

Comments
 (0)