Skip to content
Snippets Groups Projects
Commit 40dcae90 authored by Cristian Weiland's avatar Cristian Weiland
Browse files

Issue #25: Script also checks if variables in config file are set.

parent 91c103f9
No related branches found
No related tags found
No related merge requests found
......@@ -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++ ));
......
......@@ -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
......
......@@ -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"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment