feat: add bin/count.sh

This commit is contained in:
dancingCycle 2023-12-16 21:44:05 +01:00
parent a5030d1b6f
commit 99100386e8
1 changed files with 24 additions and 0 deletions

24
bin/count.sh Normal file
View File

@ -0,0 +1,24 @@
#!/bin/bash
#
echo "Started..."
#Started...
#
# special variable $# is the number of arguments
if [ $# -lt 3 ] ; then
echo 'Call ./<script> <db name> <db user> <db schema>'
exit 1
fi
#
DB_NAME="$1"
echo "DB_NAME: ${DB_NAME}"
DB_USER="$2"
echo "DB_USER: ${DB_USER}"
DB_SCHEMA="$3"
echo "DB_SCHEMA: ${DB_SCHEMA}"
#
psql -h localhost -p 5432 -U $DB_USER -f ./sql/route-count.sql -d $DB_NAME -v schema=$DB_SCHEMA
#
psql -h localhost -p 5432 -U $DB_USER -f ./sql/trip-count.sql -d $DB_NAME -v schema=$DB_SCHEMA
#
echo "Done."
#done.