Newer
Older
# Function to display help
function show_help() {
echo "Usage: $0 <host> <user> <password>"
echo ""
echo "This script sets up the database and loads the data."
echo ""
echo "Arguments:"
echo " host Database host"
echo " user Database user"
echo " password Database password"
}
# Check if help is requested
if [[ "$1" == "-h" || "$1" == "--help" ]]; then
show_help
exit 0
fi
# Check if all three parameters are provided
if [[ $# -ne 3 ]]; then
echo "Error: Missing arguments."
show_help
exit 1
fi
# Assign parameters to variables
HOST=$1
USER=$2
PASSWORD=$3
# create database
./inputs/setup_db.sh "$HOST" "$USER" "$PASSWORD"
# load TIGER objects into DB
./inputs/load_tiger.sh "$HOST" "$USER" "$PASSWORD"
# load NUTS objects into DB
./inputs/load_nuts.sh "$HOST" "$USER" "$PASSWORD"
# dump data and drop database on 'local' instance
./inputs/dump_and_drop.sh "$HOST" "$USER" "$PASSWORD"