aboutsummaryrefslogtreecommitdiffstats
path: root/asdctool/sdc-cassandra-init/scripts/create-alter-dox-db.sh
blob: 4a1aed95ab54699784f17d3d1a6b2ffe67b2a481 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/sh

# Source the environment file
. /home/sdc/scripts/cassandra-env.sh  # Replace with the actual path to your env file


if [ -z "$CASSANDRA_IP" ] || [ -z "$CS_PORT" ] || [ -z "$CASSANDRA_PASS" ] || [ -z "$SDC_USER" ] || [ -z "$SDC_PASSWORD" ]; then
    echo "One or more required environment variables are missing!"
    exit 1
fi

CASSANDRA_PORT=$CS_PORT

CASSANDRA_COMMAND="cqlsh -u $SDC_USER -p $SDC_PASSWORD $CASSANDRA_IP $CASSANDRA_PORT --cqlversion=$cqlversion"

echo "Running create_dox_db.cql"
chmod 755 /home/sdc/tools/build/scripts/create_dox_db.cql
$CASSANDRA_COMMAND -f /home/sdc/tools/build/scripts/create_dox_db.cql > /dev/null 2>&1

sleep 10

echo "Running alter_dox_db.cql"
chmod 755 /home/sdc/tools/build/scripts/alter_dox_db.cql
$CASSANDRA_COMMAND -f /home/sdc/tools/build/scripts/alter_dox_db.cql > /dev/null 2>&1