Browse Source

Allow cron.daily to run if last run was more than 7 day ago.

Patch from Vagrant Cascadian. Closes: #610876
suites/ascii
Bill Allombert 12 years ago
parent
commit
18d1a462ce
  1. 3
      FAQ
  2. 6
      debian/changelog
  3. 14
      debian/cron.daily

3
FAQ

@ -62,6 +62,9 @@ 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.
If /etc/cron.daily/popularity-contest has not run for more than a week, it will
accept to run any day.
Q) I don't want popcon email to be sent by root! How can I change that ?
A) To send as user 'myuser', edit the function 'do_sendmail' in

6
debian/changelog

@ -5,7 +5,11 @@ popularity-contest (1.52) UNRELEASED; urgency=low
* Translations:
- Nepali (Shyam Krishna Bal). Closes: #614694
-- Bill Allombert <ballombe@debian.org> Sat, 12 Mar 2011 19:34:55 +0100
[ Bill Allombert ]
* Allow cron.daily to run if last run was more than 7 day ago.
Patch from Vagrant Cascadian. Closes: #610876
-- Bill Allombert <ballombe@debian.org> Sun, 20 Mar 2011 13:31:30 +0100
popularity-contest (1.51) unstable; urgency=low

14
debian/cron.daily

@ -26,16 +26,26 @@ if [ -n "$HTTP_PROXY" ]; then
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)
# 6.5 days, in seconds
week=561600
if [ "$(( $now - $lastrun ))" -le "$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()
{

Loading…
Cancel
Save