09a0fccf11fcd7935e211ec21c0d429e5cf54471
[aaf/authz.git] / auth / auth-cass / cass_init / push.sh
1 #!/bin/bash
2 #
3 # Push data from Cassandra ".dat" files into Tables
4 # These are obtained from "gzipped" files, or pre-placed (i.e. initialization) 
5 #   in the "dats" directory
6 #
7 DIR=/opt/app/aaf/cass_init
8 cd $DIR
9 if [ ! -e dats ]; then
10   if [ -e dat.gz ]; then
11      tar -xvf dat.gz
12   else 
13      echo "No Data to push for Cassandra"
14      exit
15   fi
16 fi
17 cd dats
18 for T in $(ls *.dat); do
19   if [ -s $T ]; then
20     cqlsh -e "COPY authz.${T/.dat/} FROM '$T' WITH DELIMITER='|';"
21   fi
22 done
23 cd $DIR
24 #rm -Rf dats
25