Bug#847314: awstats: add databasebreak support in update.sh
I've attached v2 patch. It has break statement to stop at first iteration in case of error (if there are many database breaks as "month day hour"). diff --git a/debian/default/awstats b/debian/default/awstats index cf06f7d..75a851f 100644 --- a/debian/default/awstats +++ b/debian/default/awstats @@ -17,3 +17,10 @@ AWSTATS_LANG="en" # This variable controls whether to run regular cron jobs for awstats. Set # to "yes" or "no" (default to "yes"). AWSTATS_ENABLE_CRONTABS="yes" + +# This variable controls how statistics are partitioned. Set "month", "day", +# "hour" or a combination as "month day". If variable is not set, default +# AWStats database break is used (month). Set additional CGI arguments as +# "&databasebreak=hour&day=3&hour=14 to access summary of the specific hour +# for the specific day. +AWSTATS_DATABASE_BREAKS= diff --git a/debian/update.sh b/debian/update.sh index c83bfeb..7aad8fd 100755 --- a/debian/update.sh +++ b/debian/update.sh @@ -28,12 +28,17 @@ for c in `/bin/ls -1 awstats.*.conf 2>/dev/null | \ /bin/sed 's/^awstats\.\(.*\)\.conf/\1/'` \ `[ -f /etc/awstats/awstats.conf ] && echo awstats` do - if ! nice -n $AWSTATS_NICE $AWSTATS \ + for b in ${AWSTATS_DATABASE_BREAKS:-""} + do +if ! nice -n $AWSTATS_NICE $AWSTATS \ + ${b:+-databasebreak=${b}} \ -config=$c \ -update >$ERRFILE 2>&1 - then -echo "Error while processing" \ - "/etc/awstats/awstats$(test $c != awstats && echo .$c).conf" >&2 -cat $ERRFILE >&2 # an error occurred - fi +then + echo "Error while processing" \ + "/etc/awstats/awstats$(test $c != awstats && echo .$c).conf" >&2 + cat $ERRFILE >&2 # an error occurred + break +fi + done done
Bug#847314: awstats: add databasebreak support in update.sh
tags 847314 patch thanks I've implemented patch on top of current git master which I tested on stretch. diff --git a/debian/default/awstats b/debian/default/awstats index cf06f7d..bb0b857 100644 --- a/debian/default/awstats +++ b/debian/default/awstats @@ -17,3 +17,10 @@ AWSTATS_LANG="en" # This variable controls whether to run regular cron jobs for awstats. Set # to "yes" or "no" (default to "yes"). AWSTATS_ENABLE_CRONTABS="yes" + +# This variable controls how statistics are partitioned. Set "month", "day", +# "hour" or a combination as "month day". If variable is not set, default +# AWStats database break is used (month). Set additional CGI arguments as +# "&databasebreak=hour&day=3&hour=14 to access summary of the specific hour +# for the specific day. +AWSTATS_DATABASE_BREAKS= diff --git a/debian/update.sh b/debian/update.sh index c83bfeb..47651db 100755 --- a/debian/update.sh +++ b/debian/update.sh @@ -28,12 +28,16 @@ for c in `/bin/ls -1 awstats.*.conf 2>/dev/null | \ /bin/sed 's/^awstats\.\(.*\)\.conf/\1/'` \ `[ -f /etc/awstats/awstats.conf ] && echo awstats` do - if ! nice -n $AWSTATS_NICE $AWSTATS \ + for b in ${AWSTATS_DATABASE_BREAKS:-""} + do +if ! nice -n $AWSTATS_NICE $AWSTATS \ + ${b:+-databasebreak=${b}} \ -config=$c \ -update >$ERRFILE 2>&1 - then -echo "Error while processing" \ - "/etc/awstats/awstats$(test $c != awstats && echo .$c).conf" >&2 -cat $ERRFILE >&2 # an error occurred - fi +then + echo "Error while processing" \ + "/etc/awstats/awstats$(test $c != awstats && echo .$c).conf" >&2 + cat $ERRFILE >&2 # an error occurred +fi + done done
Bug#847314: awstats: add databasebreak support in update.sh
On Sat, Dec 10, 2016 at 04:22:56PM +0200, Vincas Dargis wrote: > No I am not, I do not know what's that "collab-maint" or how to join it. It's there: https://alioth.debian.org/projects/collab-maint/ Just ask admins to join, comment why (i.e. where you would like to contribute). (Or, if you prefer, just attach patches to this bug.) > >There is RFA bug #755797 - so feel free to join package maintenance or > >take over package maintenence. I'll try to help you as best, as I can. > > Sadly, it seems I only have energy for some bug reports and minor patches > here and there; package maintenance would be over my head. Not a surprise to me. Package is big and code is messy. Neverless, any help is welcomed. > So in retrospect, would you find some time to review/accept my patch, or > should I use some other channels (such as that collab-maint, whatever that > means :-) ). Sure, I'll try. Probably, this can enter next release, but no promises.
Bug#847314: awstats: add databasebreak support in update.sh
2016.12.10 14:35, Sergey B Kirpichev wrote: On Sat, Dec 10, 2016 at 12:24:00PM +0200, Vincas Dargis wrote: If you are member of the alioth group collab-maint (feel free to join) - you also can just commit your changes. No I am not, I do not know what's that "collab-maint" or how to join it. There is RFA bug #755797 - so feel free to join package maintenance or take over package maintenence. I'll try to help you as best, as I can. Sadly, it seems I only have energy for some bug reports and minor patches here and there; package maintenance would be over my head. So in retrospect, would you find some time to review/accept my patch, or should I use some other channels (such as that collab-maint, whatever that means :-) ). Thanks.
Bug#847314: awstats: add databasebreak support in update.sh
On Sat, Dec 10, 2016 at 12:24:00PM +0200, Vincas Dargis wrote: > Could you hint me the proper way to produce patch? > > I image I should install Debian Jesting virtual machine, checkout latest > source package... do changes in update.sh, build & install package, test, > and then generate diff with git, attach here? If you are member of the alioth group collab-maint (feel free to join) - you also can just commit your changes. Please use common sense and standard practice for that (i.e. one logical change per commit, good commit messages). There is RFA bug #755797 - so feel free to join package maintenance or take over package maintenence. I'll try to help you as best, as I can. Regarding tests - probably, you can also test update.sh on live version with Jessie's version (update.sh has no changes, but I don't remember if databasebreak switch is working on that version). But in general - yes. You need some testing setup, e.g. in VM.
Bug#847314: awstats: add databasebreak support in update.sh
2016.12.07 12:58, Sergey B Kirpichev wrote: Sounds interesting, feel free to provide the patch. Could you hint me the proper way to produce patch? I image I should install Debian Jesting virtual machine, checkout latest source package... do changes in update.sh, build & install package, test, and then generate diff with git, attach here? Thanks.
Bug#847314: awstats: add databasebreak support in update.sh
severity 847314 wishlist thanks On Wed, Dec 07, 2016 at 11:03:47AM +0200, Vincas Dargis wrote: > Awstats has `databasebreak` parameter witch which user can access to statistic > per day basis, for example, instead only by month due to current defaults. > > update.sh currently has two parameters set, with no possibility to apply > `-databasebreak=...`: > -config=$c \ > -update >$ERRFILE 2>&1 > > It would be useful to have a way to define databasebreak’s inside > /etc/default/awstats file, to generate possibly multiple data files per config > file (for every break). Later, user could set `awstats.cgi?databasebreak=day` > cgi argument to access that data. By default, if no `AWSTATS_DATABASE_BREAK` > is > set in defaults file, it should not apply `-databasebreak` argument to keep > backwards compatibility. Sounds interesting, feel free to provide the patch.
Bug#847314: awstats: add databasebreak support in update.sh
Package: awstats Version: 7.5+dfsg-1 Severity: normal Dear Maintainer, Awstats has `databasebreak` parameter witch which user can access to statistic per day basis, for example, instead only by month due to current defaults. update.sh currently has two parameters set, with no possibility to apply `-databasebreak=...`: -config=$c \ -update >$ERRFILE 2>&1 It would be useful to have a way to define databasebreak’s inside /etc/default/awstats file, to generate possibly multiple data files per config file (for every break). Later, user could set `awstats.cgi?databasebreak=day` cgi argument to access that data. By default, if no `AWSTATS_DATABASE_BREAK` is set in defaults file, it should not apply `-databasebreak` argument to keep backwards compatibility. Looking forward for Maintainers comments. -- System Information: Debian Release: stretch/sid APT prefers testing APT policy: (500, 'testing') Architecture: amd64 (x86_64) Kernel: Linux 4.8.0-1-amd64 (SMP w/3 CPU cores) Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Init: systemd (via /run/systemd/system) Versions of packages awstats depends on: ii perl 5.24.1~rc4-1 Versions of packages awstats recommends: ii coreutils 8.25-2+b1 ii libnet-xwhois-perl 0.90-4 Versions of packages awstats suggests: ii apache2 [httpd] 2.4.23-8 pn libgeo-ipfree-perl pn libnet-dns-perl pn libnet-ip-perl ii liburi-perl 1.71-1 -- no debconf information