summaryrefslogtreecommitdiffstats
path: root/wiki/openshift/mysql-import.sh
blob: 619baf8feff3bad25c528bec202fc76143f2b847 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#/bin/sh +x

if [ $# != 1 ]; then
    echo "usage: mysql-import.sh <file>"
    exit 1
fi

FILE=`basename $1`
DIR=`dirname $1`

POD=`oc get pods -l deploymentconfig=mysql | grep -v NAME | awk '{ print $1; }'`

oc rsync $DIR $POD:/tmp --exclude=* --include=$FILE --no-perms
oc rsh $POD /opt/rh/rh-mysql57/root/usr/bin/mysql -u root wiki -e "source /tmp/$FILE"
oc rsh $POD rm -rf /tmp/$FILE