Page MenuHomeDevCentral

mysql.sh
No OneTemporary

mysql.sh

#!/bin/sh
# -------------------------------------------------------------
# PaaS Docker
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Project: Nasqueron
# Created: 2015-04-21
# License: Trivial work, not eligible to copyright
# Source file: roles/paas-docker/wrappers/files/mysql.sh
# -------------------------------------------------------------
#
# <auto-generated>
# This file is managed by our rOPS SaltStack repository.
#
# Changes to this file may cause incorrect behavior
# and will be lost if the state is redeployed.
# </auto-generated>
if [ "$#" -eq 0 ]; then
echo "Usage: $0 <container name>" 1>&2;
exit 1
fi
# -------------------------------------------------------------
# Determine and validate MySQL container
#
# Validation code by Erik Kristensen <erik@erikkristensen.com>
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CONTAINER=$1
shift
RUNNING=$(docker inspect --format="{{ .State.Running }}" "$CONTAINER" 2> /dev/null)
if [ $? -eq 1 ]; then
echo "$0: $CONTAINER does not exist."
exit 3
fi
if [ "$RUNNING" = "false" ]; then
echo "$0: $CONTAINER is not running."
exit 2
fi
# -------------------------------------------------------------
# Run container
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
docker run -it --rm \
--link "$CONTAINER:mysql" \
nasqueron/mysql sh -c 'exec mysql -h"$MYSQL_PORT_3306_TCP_ADDR" -P"$MYSQL_PORT_3306_TCP_PORT" -uroot -p"$MYSQL_ENV_MYSQL_ROOT_PASSWORD"'

File Metadata

Mime Type
text/x-shellscript
Expires
Fri, Feb 28, 21:45 (1 d, 14 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2436263
Default Alt Text
mysql.sh (1 KB)

Event Timeline