diff --git a/scripts/expenses/insert_expenses.sh b/scripts/expenses/insert_expenses.sh index 3ec22d54a1f18f90689c284a65b13f61a2e5034a..4d37253d2826bba31ff54321c5fb0c06e5fdd4dd 100755 --- a/scripts/expenses/insert_expenses.sh +++ b/scripts/expenses/insert_expenses.sh @@ -17,6 +17,25 @@ if [ "$#" -ne 4 ]; then exit fi +source ./config.sh + +if [ -z ${index+x} ]; then + echo "Var 'index' is unset. Set it in file 'scripts/expenses/config.sh'."; + exit; +fi +if [ -z ${host+x} ]; then + echo "Var 'host' is unset. Set it in file 'scripts/expenses/config.sh'."; + exit; +fi +if [ -z ${filter+x} ]; then + echo "Var 'filter' is unset. Set it in file 'scripts/expenses/config.sh'."; + exit; +fi +if [ -z ${university+x} ]; then + echo "Var 'university' is unset. Set it in file 'scripts/expenses/config.sh'."; + exit; +fi + # Getting the Last day of this month (Using date 2016-05-15 as example): # First, get next month (201606). aux=$(date +%Y%m -d "$(date +${1}${2}15) next month") @@ -51,8 +70,6 @@ unzip -o $path$ym/${1}${2}_GastosDiretos.zip -d $path$ym/ # Remove zip file rm $path$ym/${1}${2}_GastosDiretos.zip -source ./config.sh - length=${#filter[@]} for (( i=0; i<${length}; i++ )); diff --git a/scripts/travel_allowances/insert_travel_allowances.sh b/scripts/travel_allowances/insert_travel_allowances.sh index fb2b6b34d3e572afb7ef451866deefa9fd2fb754..7687e6b4ecdac4fa5a3c57166bb6e3cb91c3f74a 100755 --- a/scripts/travel_allowances/insert_travel_allowances.sh +++ b/scripts/travel_allowances/insert_travel_allowances.sh @@ -17,6 +17,25 @@ if [ "$#" -ne 4 ]; then exit fi +source config.sh + +if [ -z ${index+x} ]; then + echo "Var 'index' is unset. Set it in file 'scripts/travel_allowance/config.sh'."; + exit; +fi +if [ -z ${host+x} ]; then + echo "Var 'host' is unset. Set it in file 'scripts/travel_allowance/config.sh'."; + exit; +fi +if [ -z ${filter+x} ]; then + echo "Var 'filter' is unset. Set it in file 'scripts/travel_allowance/config.sh'."; + exit; +fi +if [ -z ${university+x} ]; then + echo "Var 'university' is unset. Set it in file 'scripts/travel_allowance/config.sh'."; + exit; +fi + # Getting the Last day of this month (Using date 2016-05-15 as example): # First, get next month (201606). aux=$(date +%Y%m -d "$(date +${1}${2}15) next month") @@ -30,8 +49,6 @@ dataPath="../../data/" path="../../data/travel_allowance/" configPath="../../configs/travel_allowance/logstash/" -source config.sh - if [ ! -d "$path/processed" ]; then mkdir -p "$path/processed" fi diff --git a/scripts/workers/insert_register_payment.sh b/scripts/workers/insert_register_payment.sh index 7e286fd9ec633e5e076ca4fbcf39760853c445e0..4cb384aab8be30e5aea7e98c5dc91308ac9ab38d 100755 --- a/scripts/workers/insert_register_payment.sh +++ b/scripts/workers/insert_register_payment.sh @@ -22,13 +22,30 @@ if [ "$#" -ne 4 ]; then exit fi +source config.sh + +if [ -z ${index+x} ]; then + echo "Var 'index' is unset. Set it in file 'scripts/workers/config.sh'."; + exit; +fi +if [ -z ${host+x} ]; then + echo "Var 'host' is unset. Set it in file 'scripts/workers/config.sh'."; + exit; +fi +if [ -z ${filter+x} ]; then + echo "Var 'filter' is unset. Set it in file 'scripts/workers/config.sh'."; + exit; +fi +if [ -z ${university+x} ]; then + echo "Var 'university' is unset. Set it in file 'scripts/workers/config.sh'."; + exit; +fi + ym=$1-$2 dataPath="../../data/" path="../../data/workers/" configPath="../../configs/workers/" -source config.sh - # Check if Data and Workers directories already exist: if [ ! -d "$path" ]; then mkdir -p "$path"