Let dopostingstats default to last month.

Signed-off-by: Thomas Hochstein <thh@thh.name>
This commit is contained in:
Thomas Hochstein 2025-05-31 18:34:41 +02:00
parent 8afeb09cc2
commit 18db200aea
2 changed files with 10 additions and 6 deletions

View file

@ -1,10 +1,13 @@
#!/bin/bash
# installation path is /srv/newsstats/, please adjust accordingly
if [[ $1 =~ [0-9]{4}-[0-9]{2} ]]; then
/srv/newsstats/bin/groupstats.pl --nocomments --sums --format dump --month $1 | /srv/newsstats/bin/postingstats.pl --month $1 | /srv/newsstats/contrib/tinews.pl -X -Y
/srv/newsstats/bin/hoststats.pl --nocomments --sums --format dump --month $1 | /srv/newsstats/bin/postingstats.pl -t server --month $1 | /srv/newsstats/contrib/tinews.pl -X -Y
/srv/newsstats/bin/clientstats.pl --nocomments --sums --versions --format dump --month $1 | /srv/newsstats/bin/postingstats.pl -t client --month $1 | /srv/newsstats/contrib/tinews.pl -X -Y
else
echo 'Input error, please use dopostingstats.sh YYYY-MM'
# get month
MONTH=$1
if ! [[ $1 =~ [0-9]{4}-[0-9]{2} ]]; then
MONTH=$(date -d "$(date +%Y-%m-15) -1 month" '+%Y-%m')
fi
# post stats
/srv/newsstats/bin/groupstats.pl --nocomments --sums --format dump --month $MONTH | /srv/newsstats/bin/postingstats.pl --month $MONTH | /srv/newsstats/contrib/tinews.pl -X -Y
/srv/newsstats/bin/hoststats.pl --nocomments --sums --format dump --month $MONTH | /srv/newsstats/bin/postingstats.pl -t server --month $MONTH | /srv/newsstats/contrib/tinews.pl -X -Y
/srv/newsstats/bin/clientstats.pl --nocomments --sums --versions --format dump --month $MONTH | /srv/newsstats/bin/postingstats.pl -t client --month $MONTH | /srv/newsstats/contrib/tinews.pl -X -Y

View file

@ -14,6 +14,7 @@ NewsStats 0.4.0 (unreleased)
* gatherstats: Remove whitespace from client and version.
* Fix version queries.
* Add ClientStats to dopostingstats.
* Let dopostingstats default to last month.
NewsStats 0.3.0 (2025-05-18)
* Extract GroupStats (in gatherstats) to subroutine.