Browse Source

Instead of reporting on Sunday, now a random day in the week is

chosen. This spread the load on the server. Closes: #440493, #459910.
suites/ascii
Bill Allombert 14 years ago
parent
commit
0d292a0b27
  1. 15
      FAQ
  2. 2
      debian/changelog
  3. 5
      debian/cron.daily
  4. 14
      debian/postinst
  5. 25
      debian/preinst

15
FAQ

@ -53,13 +53,14 @@ A) popularity-contest relies on atime to know what packages were used during
Q) When does popularity-contest run ?
A) popularity-contest is run by the weekly cron job
"/etc/cron.weekly/popularity-contest".
Under the default configuration of cron, this happens every Sunday
at 6:47 in the morning. This can be changed by editing /etc/crontab
but if your computer is not always turned on, we really recommend you
install the anacron package.
A) popularity-contest is run by the daily cron job
"/etc/cron.daily/popularity-contest", but only one day in the week,
whci is specified in the configuration file. This day is chosen randomly
to spread the load on the server.
Under the default configuration of cron, this happens at 6:47 in the morning.
This can be changed by editing /etc/crontab but if your computer is not always
turned on, we really recommend you install the anacron package.
Q) I don't want popcon email to be sent by root! How can I change that ?

2
debian/changelog

@ -8,6 +8,8 @@ popularity-contest (1.45) UNRELEASED; urgency=low
- revert changes introduced in 1.44.
- Use :encoding(UTF-8) instead of :utf8 when reapding packages files
- Add query box linking to <http://qa.debian.org/popcon.php>
* Instead of reporting on Sunday, now a random day in the week is
chosen. This spread the load on the server. Closes: #440493, #459910.
-- Bill Allombert <ballombe@debian.org> Mon, 05 May 2008 22:00:55 +0200

5
debian/cron.weekly → debian/cron.daily

@ -26,6 +26,11 @@ if [ -n "$HTTP_PROXY" ]; then
export http_proxy="$HTTP_PROXY";
fi
# Only run on the given day, to spread the load on the server a bit
if [ "$DAY" ] && [ "$DAY" != "$(date +%w)" ] ; then
exit 0
fi
# keep old logs
cd /var/log
umask 022

14
debian/postinst

@ -34,8 +34,14 @@ generate_id() {
fi
}
# Select a random day to submit on, to spread the load over time, unless it is already set.
select_random_day() {
DAY=`bash -c 'echo $(($RANDOM % 7))'`
}
generate_conffile() {
generate_id
select_random_day
cat <<-EOF >$conffile
# Config file for Debian's popularity-contest package.
#
@ -50,6 +56,7 @@ generate_conffile() {
MY_HOSTID="$MY_HOSTID"
PARTICIPATE="$PARTICIPATE"
USEHTTP="yes"
DAY="$DAY"
EOF
# preseeding is only allowed on first time install
@ -77,6 +84,13 @@ case "$1" in
# of behaviour with stdin. version 1.17, 2004-04-12.
*-) MY_HOSTID="${MY_HOSTID% -}";;
esac;
# If DAY is not set, add it.
if [ -z "$DAY" ] ; then
select_random_day
echo "DAY=\"$DAY\"" >> $conffile
fi
# Replace only if the content changed, to avoid changing the
# config file date when no change was done.

25
debian/preinst

@ -1,10 +1,23 @@
#!/bin/sh
case "$1" in
install|upgrade)
# Move a conffile without triggering a dpkg question if it was not modified.
if dpkg --compare-versions "$2" le "1.44"; then
PKGNAME="popularity-contest"
CONFFILE="/etc/cron.weekly/popularity-contest"
NEWCONFFILE="/etc/cron.daily/popularity-contest"
if [ -e "$CONFFILE" ]; then
md5sum="`md5sum \"$CONFFILE\" | sed -e \"s/ .*//\"`"
old_md5sum="`dpkg-query -W -f='${Conffiles}' $PKGNAME | sed -n -e \"\\\\' $CONFFILE '{s/ obsolete$//;s/.* //p}\"`"
if [ "$md5sum" = "$old_md5sum" ]; then
rm -f "$CONFFILE"
else
mv -f "$CONFFILE" "$NEWCONFFILE"
fi
fi
fi
esac
#DEBHELPER#
# older versions had popularity-contest as a conffile in a different dir, so
# it won't get removed automatically.
#
if [ "$1" = upgrade ]; then
rm -f /etc/cron.daily/popularity-contest
fi

Loading…
Cancel
Save