# Filename: startDynamoDBTableExport.sh # Author: leewc # This script copies the specific columns in the monthly CustomerTracker tables to a new yearly table for anniversary promotions. # This is used in conjuction with the dynamoTodynamo.hive script. # Note: You may need to provide execute permissions to run this script. [ chmod +x startDynamoDBTableExport.sh ] # You will have to explicitly specify the domain, region and months in this file. This is by design to avoid # copying the wrong data between regions. # #!/bin/sh months=(201705 201704 201703 201702 201701 201612 201611 201610 201609 201608 201607 201606 201605) domain="Devo" region="NA" function _start() { for month in ${months[@]} do echo "Beginning Hive Copy for CustomerTracker_${domain}_${region}_${month}". hive -hiveconf domain=${domain} -hiveconf region=${region} -hiveconf yyyymm=${month} -f inflight-dynamoTodynamo.hive done } echo "This will run dynamoTodynamo Hive script for " ${domain} " and " ${region} echo "With the following months: " echo "" echo ${months[*]} echo "" while true; do read -p "Are you sure this is what you want (Y/N)? " yn case $yn in [Yy] ) _start; break;; [Nn] ) echo "Aborting operation."; exit;; * ) echo "Please answer yes (Y) or no (N).";; esac done