This commit is contained in:
2024-10-13 23:21:42 +02:00
commit bbaf7b7487
14 changed files with 2026 additions and 0 deletions

33
stat.sh Normal file
View File

@@ -0,0 +1,33 @@
#!/bin/bash
echo " [client]
user=andregeissler_bikeparts
password=K01v1kk0!
host=vesta.agserver.de
database=andregeissler_bikeparts
" > mystat.conf
year=$1
if [ "$year" == "" ]
then
year=2023
fi
for months in `seq 12 -1 0`
do
month=$(printf "%02d" $months)
if [ "$month" == "00" ]
then
where="$year-%"
stat="$year"
else
where="$year-$month-%"
stat="$year-$month"
fi
query="select '$stat', ifnull(round(sum(a_distance)/1000,2),'') as km, ifnull(round(sum(a_duration)/3600,2),'') as std, ifnull(round(sum(a_hm),2),'') as hm from activities where a_date like '$where'";
PASS='K01v1kk0!'
echo "$query" | mysql --defaults-extra-file=mystat.conf -t
done
rm mystat.conf