From bc7dbb316919917d053796ad3caeeeb0f95f311d Mon Sep 17 00:00:00 2001 From: david hill Date: Tue, 28 Nov 2017 13:24:18 -0600 Subject: [PATCH] MCOL-942 - backported mysql rep fixes from 1.1 - newscript --- oam/install_scripts/mariadb-command-line.sh | 59 +++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 oam/install_scripts/mariadb-command-line.sh diff --git a/oam/install_scripts/mariadb-command-line.sh b/oam/install_scripts/mariadb-command-line.sh new file mode 100644 index 000000000..bb2750581 --- /dev/null +++ b/oam/install_scripts/mariadb-command-line.sh @@ -0,0 +1,59 @@ +#!/bin/bash +# +# $Id$ +# +# generic MariaDB Columnstore Command Line script. +# +# Notes: This script gets run by ProcMon during installs and upgrades: + +# check log for error +checkForError() { + grep ERROR /tmp/mariadb-command-line.log > /tmp/error.check + if [ `cat /tmp/error.check | wc -c` -ne 0 ]; then + echo "ERROR: check log file: /tmp/mariadb-command-line.log" + rm -f /tmp/error.check + exit 1 + fi + rm -f /tmp/error.check +} + +prefix=/usr/local +installdir=$prefix/mariadb/columnstore +pwprompt= +for arg in "$@"; do + if [ `expr -- "$arg" : '--command='` -eq 10 ]; then + command1="`echo $arg | awk -F= '{print $2}'`" + command2="`echo $arg | awk -F= '{print $3}'`" + command=$command1"="$command2 + elif [ `expr -- "$arg" : '--installdir='` -eq 13 ]; then + installdir="`echo $arg | awk -F= '{print $2}'`" + prefix=`dirname $installdir` + elif [ `expr -- "$arg" : '--port='` -eq 7 ]; then + port="`echo $arg | awk -F= '{print $2}'`" + fi +done + +test -f $installdir/post/functions && . $installdir/post/functions + + +>/tmp/mariadb-command-line.log + +# +# Run command +# +echo "Run command" >>/tmp/mariadb-command-line.log +cat >/tmp/mariadb-command-line.sql <> /tmp/mariadb-command-line.log +$installdir/mysql/bin/mysql \ + --defaults-extra-file=$installdir/mysql/my.cnf \ + --user=root \ + calpontsys < /tmp/mariadb-command-line.sql >> /tmp/mariadb-command-line.log 2>&1 + +checkForError + +#alls good, 'OK' for success +echo "OK" +exit 0