Spotter-VM/mariadb/setup/etc/init.d/mariadb

25 lines
408 B
Plaintext
Executable File

#!/sbin/openrc-run
description="MariaDB docker container"
depend() {
need docker
}
start() {
/usr/bin/docker run -d --rm \
--name mariadb \
-h mariadb \
-v /srv/mariadb/conf:/etc/mysql \
-v /srv/mariadb/data:/var/lib/mysql \
mariadb
}
start_post() {
timeout -t 60 docker exec mariadb sh -c 'until [ -e /run/mysqld/mysqld.sock ]; do usleep 50000; done'
}
stop() {
/usr/bin/docker stop mariadb
}