Skip to content

Commit

Permalink
Possibility of executing the script from another folder
Browse files Browse the repository at this point in the history
  • Loading branch information
nachoaguadoc committed Sep 10, 2015
1 parent 40bcc4c commit 7214ad3
Showing 1 changed file with 48 additions and 26 deletions.
74 changes: 48 additions & 26 deletions scripts/info_ackuaria.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,48 @@
#!/bin/bash

ACKUARIA_URL="http://poochie.dit.upm.es:8888/ackuaria" #HOST URL http://hostname:port/ackuaria
ACKUARIA_URL="" #HOST URL http://hostname:port/ackuaria

# DATE FORMAT: YYYY/DD/MM-hh/mm
DATE=`date +%Y-%m-%d:%H:%M:%S`
FILE_NAME="../reports/"$DATE"_report.json"
DATE=`date +%Y%m%d%H%M%S`

SCRIPT=`pwd`/$0
PATHNAME=`dirname $SCRIPT`
ROOT=$PATHNAME/..
REPORT_DIR=$ROOT/reports/
FILE_NAME=$REPORT_DIR$DATE"_report.json"


usage()
{
cat << EOF
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Welcome to the help page of the Ackuaria Stats Script. +
+ +
+ Commands: +
+ +
+ . First Parameter: Level of detail +
+ -g --> General information +
+ -d --> Add Detailed information by Room +
+ +
+ . Second Parameter: Query by dates +
+ -t --> Total information +
+ -q INITDATE FINALDATE --> Between two dates +
+ -i INITDATE --> Since date +
+ -f FINALDATE --> Until date +
+ +
+ Response format: JSON +
+ Dates format: DD/MM/YYYY-hh:mm +
+ If you dont specificate any time, 00:00 will be used +
+ Please, always use double digits for days, month and time +
+ +
+ Example: ./info_ackuaria.sh -d -i 01/07/2014-07:53 +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
EOF
}

case "$1" in
-g)
TYPE="general"
Expand All @@ -12,29 +51,8 @@ case "$1" in
-d) TYPE="detailed"
;;

*)
echo " + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +"
echo " + Welcome to the help page of the Ackuaria Stats Script. +"
echo " + +"
echo " + Commands: +"
echo " + +"
echo " + . First Parameter: Level of detail +"
echo " + -g --> General information +"
echo " + -d --> Add Detailed information by Room +"
echo " + +"
echo " + . Second Parameter: Query by dates +"
echo " + -t --> Total information +"
echo " + -q INITDATE FINALDATE --> Between two dates +"
echo " + -i INITDATE --> Since date +"
echo " + -f FINALDATE --> Until date +"
echo " + +"
echo " + Response format: JSON +"
echo " + Dates format: DD/MM/YYYY-hh:mm +"
echo " + If you don't specificate any time, 00:00 will be used +"
echo " + Please, always use double digits for days, month and time +"
echo " + +"
echo " + Example: ./info_ackuaria.sh -d -i 01/07/2014-07:53 +"
echo " + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +"
*) usage

;;
esac

Expand Down Expand Up @@ -76,6 +94,10 @@ case "$2" in

;;

*) echo " Error: Please, specify the second parameter"
usage
;;

esac


Expand Down

0 comments on commit 7214ad3

Please sign in to comment.