Skip to content

Commit dc397d5

Browse files
committed
Properly notify the supervisor that mysqld is ready.
1 parent b04d2ad commit dc397d5

File tree

2 files changed

+9
-2
lines changed
  • rootfs/etc/services.d/mysqld

2 files changed

+9
-2
lines changed

rootfs/etc/services.d/mysqld/data/check

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,5 @@ set -e # Exit immediately if a command exits with a non-zero status.
44
set -u # Treat unset variables as an error.
55

66
echo 'SELECT 1' | mysql &> /dev/null
7-
#[ -f /config/mysql/.initialized ] && echo 'SELECT 1' | mysql &> /dev/null
87

98
# vim:ft=sh:ts=4:sw=4:et:sts=4

rootfs/etc/services.d/mysqld/run

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,15 @@ set -u # Treat unset variables as an error.
66
mkdir -p /run/mysqld
77
chown $USER_ID:$GROUP_ID /run/mysqld
88

9+
MYSQLD_CMD="/usr/bin/mysqld --datadir /config/mysql --tmpdir /tmp/"
10+
911
echo "[$(basename "$(pwd)")] starting..."
10-
exec s6-applyuidgid -u $USER_ID -g $GROUP_ID -G ${SUP_GROUP_IDS:-$GROUP_ID} /usr/bin/mysqld --datadir /config/mysql --tmpdir /tmp/
12+
if [ -d /var/run/s6/services/mysqld ]; then
13+
# Supervisor is running.
14+
exec /bin/s6-notifyoncheck s6-applyuidgid -u $USER_ID -g $GROUP_ID -G ${SUP_GROUP_IDS:-$GROUP_ID} $MYSQLD_CMD
15+
else
16+
# Supervisor is not running: we are starting the db from the init script.
17+
exec s6-applyuidgid -u $USER_ID -g $GROUP_ID -G ${SUP_GROUP_IDS:-$GROUP_ID} $MYSQLD_CMD
18+
fi
1119

1220
# vim:ft=sh:ts=4:sw=4:et:sts=4

0 commit comments

Comments
 (0)