From 91c103f9a312f428d57170323a44c2212a65bc88 Mon Sep 17 00:00:00 2001 From: Cristian Weiland <cw14@inf.ufpr.br> Date: Mon, 20 Mar 2017 09:30:03 -0300 Subject: [PATCH] Issue #25: Improve documentation from scripts Signed-off-by: Cristian Weiland <cw14@inf.ufpr.br> --- scripts/expenses/README | 6 ++++++ scripts/expenses/config.sh | 2 +- scripts/insert_data.sh | 7 +++++++ scripts/travel_allowances/README | 6 ++++++ scripts/travel_allowances/config.sh | 2 +- scripts/workers/README | 6 ++++++ scripts/workers/config.sh | 2 +- 7 files changed, 28 insertions(+), 3 deletions(-) diff --git a/scripts/expenses/README b/scripts/expenses/README index e37c4de..d121957 100644 --- a/scripts/expenses/README +++ b/scripts/expenses/README @@ -1,6 +1,12 @@ The easiest way to insert expenses data is to use 'insert_expenses.sh'. Script's input: Year, month and day from the data to be inserted, ElasticSearch's user and password. The day should be the last day of the month. +The script also uses a config file named 'config.sh'. This is a small shell script that need to only declare some variables: index, host, filter and universities: +- Index: The index prefix to be saved on ElasticSearch. +- Host: The hostname of the machine runnning ElasticSearch. +- Filter: An array of n values, that will create n indexes in ElasticSearch, each one filtering data from Portal Transparencia using its corresponding string. Ex: "UNIVERSIDADE FEDERAL DO PARANA" +- University: An array of n values, with n being the same n as Filter's array. This array should contain the initials from Universities declared in Filter array, in the same order. + Example: ./insert_expenses.sh 2016 10 31 myuser mypass Example 2: ./insert_expenses.sh 2014 11 30 myuser mypass diff --git a/scripts/expenses/config.sh b/scripts/expenses/config.sh index 5c22af6..49a1d8a 100644 --- a/scripts/expenses/config.sh +++ b/scripts/expenses/config.sh @@ -5,7 +5,7 @@ index="gastos-pagamentos" # Filter: An array of strings that will be used on 'egrep' to filter data to get only relevant universities. -# University: An array of initials, corresponding to Filter. +# University: An array of initials, corresponding to Filter's array. They have to be in the same order! # Warning: Filter's length must be the same as university's!! filter=("UNIVERSIDADE FEDERAL DO PARANA" "UNIVERSIDADE FEDERAL DE MINAS GERAIS" "UNIVERSIDADE FEDERAL DE SANTA CATARINA" "UNIVERSIDADE FEDERAL DE PERNAMBUCO" "UNIVERSIDADE FEDERAL DE SANTA MARIA") diff --git a/scripts/insert_data.sh b/scripts/insert_data.sh index f50741e..d6ff82d 100755 --- a/scripts/insert_data.sh +++ b/scripts/insert_data.sh @@ -1,4 +1,11 @@ # This script will call every script needed to insert data. +# Parameters are the year and month from the data that will be inserted, and an elasticsearch username and password. +# Also, scripts called by insert_data.sh use a config file, located in every subfolder and called 'config.sh'. +# Those config files have some variables that have to be set: +# - Index: The index prefix to be saved on ElasticSearch. +# - Host: The hostname of the machine runnning ElasticSearch. +# - Filter: An array of n values, that will create n indexes in ElasticSearch, each one filtering data from Portal Transparencia using its corresponding string. Ex: "UNIVERSIDADE FEDERAL DO PARANA" +# - University: An array of n values, with n being the same n as Filter's array. This array should contain the initials from Universities declared in Filter array, in the same order. if [ "$#" -ne 4 ]; then echo "Usage: $0 <year> <month> <user> <password>" diff --git a/scripts/travel_allowances/README b/scripts/travel_allowances/README index 165b1f6..b92d828 100644 --- a/scripts/travel_allowances/README +++ b/scripts/travel_allowances/README @@ -1,6 +1,12 @@ The easiest way to insert travel allowance data is to use 'insert_travel_allowance.sh'. Script's input: Year and month from the data to be inserted, ElasticSearch's user and password. +The script also uses a config file named 'config.sh'. This is a small shell script that need to only declare some variables: index, host, filter and universities: +- Index: The index prefix to be saved on ElasticSearch. +- Host: The hostname of the machine runnning ElasticSearch. +- Filter: An array of n values, that will create n indexes in ElasticSearch, each one filtering data from Portal Transparencia using its corresponding string. Ex: "UNIVERSIDADE FEDERAL DO PARANA" +- University: An array of n values, with n being the same n as Filter's array. This array should contain the initials from Universities declared in Filter array, in the same order. + Example: ./insert_travel_allowance.sh 2016 10 myuser mypass Example 2: ./insert_travel_allowance.sh 2014 11 myuser mypass diff --git a/scripts/travel_allowances/config.sh b/scripts/travel_allowances/config.sh index 3cf088a..cb7e1cf 100644 --- a/scripts/travel_allowances/config.sh +++ b/scripts/travel_allowances/config.sh @@ -5,7 +5,7 @@ index="gastos-diarias" # Filter: An array of strings that will be used on 'egrep' to filter data to get only relevant universities. -# University: An array of initials, corresponding to Filter. +# University: An array of initials, corresponding to Filter's array. They have to be in the same order! # Warning: Filter's length must be the same as university's!! filter=("UNIVERSIDADE FEDERAL DO PARANA" "UNIVERSIDADE FEDERAL DE MINAS GERAIS" "UNIVERSIDADE FEDERAL DE SANTA CATARINA" "UNIVERSIDADE FEDERAL DE PERNAMBUCO" "UNIVERSIDADE FEDERAL DE SANTA MARIA") diff --git a/scripts/workers/README b/scripts/workers/README index 190ab41..092d87e 100644 --- a/scripts/workers/README +++ b/scripts/workers/README @@ -1,6 +1,12 @@ The easiest way to insert expenses data is to use 'insert_register_payment.sh'. Script's input: Year and Month from CSV file, ElasticSearch's user and password. +The script also uses a config file named 'config.sh'. This is a small shell script that need to only declare some variables: index, host, filter and universities: +- Index: The index prefix to be saved on ElasticSearch. +- Host: The hostname of the machine runnning ElasticSearch. +- Filter: An array of n values, that will create n indexes in ElasticSearch, each one filtering data from Portal Transparencia using its corresponding string. Ex: "UNIVERSIDADE FEDERAL DO PARANA" +- University: An array of n values, with n being the same n as Filter's array. This array should contain the initials from Universities declared in Filter array, in the same order. + Example (inserting data from file 20130930_Cadastro.csv): ./insert_register_payment.sh 2013 09 myuser mypassword If you want to look at more examples, check add_registers.sh. diff --git a/scripts/workers/config.sh b/scripts/workers/config.sh index 08395d6..28f0549 100644 --- a/scripts/workers/config.sh +++ b/scripts/workers/config.sh @@ -5,7 +5,7 @@ index="servidores" # Filter: An array of strings that will be used on 'egrep' to filter data to get only relevant universities. -# University: An array of initials, corresponding to Filter. +# University: An array of initials, corresponding to Filter's array. They have to be in the same order! # Warning: Filter's length must be the same as university's!! filter=("UNIVERSIDADE FEDERAL DO PARANA" "UNIVERSIDADE FEDERAL DE MINAS GERAIS" "UNIVERSIDADE FEDERAL DE SANTA CATARINA" "UNIVERSIDADE FEDERAL DE PERNAMBUCO" "UNIVERSIDADE FEDERAL DE SANTA MARIA") -- GitLab