Instrumental | bc299c0 | 2018-09-25 06:42:31 -0500 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # |
| 3 | # Push data from Cassandra ".dat" files |
| 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 "use authz; COPY ${T%.dat} FROM '$T' WITH DELIMITER='|';" |
| 21 | fi |
| 22 | done |
| 23 | cd $DIR |
| 24 | #rm -Rf dats |