diff --git a/contrib/dopostingstats.sh b/contrib/dopostingstats.sh index c0e5e8c..61ffd53 100644 --- a/contrib/dopostingstats.sh +++ b/contrib/dopostingstats.sh @@ -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 diff --git a/doc/ChangeLog b/doc/ChangeLog index 1a442c5..323e178 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -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.