[Popcon-developers] Bug#500431: popularity-contest: cronned in daily instead of (announced on) weekly

Vagrant Cascadian vagrant+debianbugs at freegeek.org
Wed Dec 10 20:27:54 UTC 2008


Package: popularity-contest
Version: 1.45
Followup-For: Bug #500431

i added a workaround in /etc/popularity-contest.conf, by grabbing the
check_stamp function from /etc/cron.daily/apt:

  check_stamp()
  {
      stamp="$1"
      interval="$2"
  
      if [ $interval -eq 0 ]; then
          return 1
      fi
  
      if [ ! -f $stamp ]; then
          return 0
      fi
  
      # compare midnight today to midnight the day the stamp was updated
      stamp=$(date --date=$(date -r $stamp --iso-8601) +%s)
      now=$(date --date=$(date --iso-8601) +%s)
      delta=$(($now-$stamp))
  
      # intervall is in days,
      interval=$(($interval*60*60*24))
      #echo "stampfile: $1"
      #echo "interval=$interval, now=$now, stamp=$stamp, delta=$delta"
  
      if [ $delta -ge $interval ]; then
          return 0
      fi
  
      return 1
  }
  
  if check_stamp /var/log/popularity-contest 7 ; then
      DAY="$(date +%w)"
  fi

live well,
  vagrant





More information about the Popcon-developers mailing list