-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsolisart-graph.sh
executable file
·48 lines (38 loc) · 1.19 KB
/
solisart-graph.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/bash
INPUT=$1
FROM_TIME="${2:-2 hour ago}"
TO_TIME="${3:-now}"
OUTTEMP="${4:-~/tmp/temperatures.png}"
#OUTCIRC="${5:-/tmp/circulateurs.png}"
usage() {
echo "
Usage:
$(basename $0) input-csv-file start end-date
Example:
~/tmp/solisart/solisart.csv
"
}
if [ "$1" = "-h" -o "$1" = "--help" ]
then
usage
exit 2
fi
if [[ ! $(find "$INPUT" -mmin -15) ]]; then
echo "${INPUT} is old (>15 min): downloading"
${HOME}/src/codeSnippets/solisart/solisart-get.rb -f csv -R -O ${INPUT}
else
echo "${INPUT} is recent (<15 min): skipping download"
fi
echo "
Plotting $INPUT from $FROM_TIME to $TO_TIME. Output written to $OUTTEMP
"
echo gnuplot -e "xfrom='$(date +"%d/%m/%y %H:%M" -d "${FROM_TIME}")'; \
xto='$(date +"%d/%m/%y %H:%M" -d "${TO_TIME}")'; \
inputfile='${INPUT}'; \
outtemp='${OUTTEMP}'; \
outcirc='${OUTCIRC}'" -p $(dirname $0)/solisart.gnuplot
gnuplot -e "xfrom='$(date +"%d/%m/%y %H:%M" -d "${FROM_TIME}")'; \
xto='$(date +"%d/%m/%y %H:%M" -d "${TO_TIME}")'; \
inputfile='${INPUT}'; \
outtemp='${OUTTEMP}'; \
outcirc='${OUTCIRC}'" -p $(dirname $0)/solisart.gnuplot