[Popcon-developers] Bug#610876: popularity-contest: Popularity contest will not be run in certain machines due to the DAY variable
Bill Allombert
Bill.Allombert at math.u-bordeaux1.fr
Wed Mar 30 15:30:10 UTC 2011
On Sat, Mar 12, 2011 at 09:27:22AM -0800, Vagrant Cascadian wrote:
> On Mon, Mar 07, 2011 at 12:33:16PM +0100, Bill Allombert wrote:
> > Is your patch valid with /bin/sh being dash ?
>
> i don't see anything that would be a problem... i haven't actually tested the
> code, but i've used all the constructs in dash scripts in the past without
> problem. is there something specific that you're wondering about?
>
>
> > This is an interesting suggestion. Maybe we would change the script to:
> > 1) always try to report on DAY.
> > 2) always try to report if /var/log/popularity-contest is more that 7 days old.
> >
> > Using the first time cron.daily runs as the reporting day unsufficiently
> > random, especially with clusters.
>
> the following updated patch should mostly address those concerns (and an
> inverted less-than/greater-than issue). it will cause it to run once on the
> first cron.daily run after install, but after that respect the DAY variable:
>
> --- cron.daily.orig 2011-03-06 08:26:52.000000000 -0800
> +++ cron.daily 2011-03-12 08:52:31.000000000 -0800
> @@ -26,16 +26,26 @@
> export http_proxy="$HTTP_PROXY";
> fi
>
> +POPCON=/var/log/popularity-contest
> +
> # Only run on the given day, to spread the load on the server a bit
> if [ "$DAY" ] && [ "$DAY" != "$(date +%w)" ] ; then
> - exit 0
> + # Ensure that popcon runs at least once in the last week
> + if [ -f "$POPCON" ] ; then
> + now=$(date +%s)
> + lastrun=$(date -r $POPCON +%s)
> + # one week, in seconds
> + week=604800
> + if [ "$(( $now - $lastrun ))" -ge "$week" ]; then
> + exit 0
> + fi
> + fi
> fi
>
> # keep old logs
> cd /var/log
> umask 022
> savelog -c 7 popularity-contest >/dev/null
> -POPCON=/var/log/popularity-contest
>
> run_popcon()
> {
Hello Vagrant,
I have applied your patch to popcon SVN on alioth, thanks!
Next time you send two patches in a single email, send one as an attachement, else
patch will apply both!
Cheers,
--
Bill. <ballombe at debian.org>
Imagine a large red swirl here.
More information about the Popcon-developers
mailing list