[build] Add database task

This commit is contained in:
Starbeamrainbowlabs 2019-01-12 23:38:05 +00:00
parent 42c69cb10c
commit c209bc662b
Signed by: sbrl
GPG Key ID: 1BE5172E637709C2
1 changed files with 12 additions and 1 deletions

13
build
View File

@ -35,7 +35,7 @@ if [[ "$#" -lt 1 ]]; then
echo -e ""; echo -e "";
echo -e "${CSECTION}Available actions${RS}"; echo -e "${CSECTION}Available actions${RS}";
echo -e " ${CACTION}setup${RS} - Perform initial setup"; echo -e " ${CACTION}setup${RS} - Perform initial setup";
echo -e " ${CACTION}setup-dev${RS} - Performa additional setup for development environments. Run after ${CACTION}setup${RS}."; echo -e " ${CACTION}setup-dev${RS} - Perform additional setup for development environments. Run after ${CACTION}setup${RS}.";
echo -e " ${CACTION}database${RS} - Connect to the database via SSH & open MariaDB CLI connection, prompting for a password"; echo -e " ${CACTION}database${RS} - Connect to the database via SSH & open MariaDB CLI connection, prompting for a password";
echo -e " ${CACTION}dev-server${RS} - Start a development server"; echo -e " ${CACTION}dev-server${RS} - Start a development server";
echo -e " ${CACTION}dev-server-stop${RS} - Stop the currently running development server"; echo -e " ${CACTION}dev-server-stop${RS} - Stop the currently running development server";
@ -73,6 +73,17 @@ function task_setup {
stage_end $?; stage_end $?;
} }
function task_database {
task_begin "Connecting to the database";
ssh -TN db.connectedhumber.org -L 3306:localhost:3306 &
ssh_pid=$!;
mysql --host localhost --port 3306 -u "${USER}" -p;
kill $!; wait; sleep 0.5;
task_end $?;
}
function task_setup-dev { function task_setup-dev {
task_begin "Checking environment"; task_begin "Checking environment";
check_command mysql true optional; check_command mysql true optional;