forked from JackKelly/CurrentCostLogger
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgenerate-graphs
executable file
·42 lines (30 loc) · 1.07 KB
/
generate-graphs
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
#!/bin/zsh -e
#
earliestDate=2012-07-01
wholePeriod() {
minutesSinceStart=$(( (`date +%s` - `date +%s -d $earliestDate`) / 60 ))
./update-power $minutesSinceStart
./update-temperature $minutesSinceStart
mv --force power-${minutesSinceStart}min.svg power-since-start.svg
mv --force temperature-${minutesSinceStart}min.svg temperature-since-start.svg
}
./update-power 5 15 60 1440 10080 43829 525949
./update-temperature 10080 43829 525949
wholePeriod
# 5 min
(while (sleep 30); do ./update-power 5; done) &
# 15 min
(while (sleep 60); do ./update-power 15; done) &
# 60 min
(while (sleep 150); do ./update-power 60; done) &
# 1440 min (day)
(while (sleep 15m); do ./update-power 1440; done) &
# 10080 min (week)
(while (sleep 3h); do ./update-power 10080; ./update-temperature 10080; done) &
# 43829 min (month)
(while (sleep 12h); do ./update-power 43829; ./update-temperature 43829; done) &
# 525949 min (year)
(while (sleep 24h); do ./update-power 525949; ./update-temperature 525949; done) &
# Since the start
(while (sleep 24h); do wholePeriod; done) &
wait