[Popcon-developers] Bug#413529: p-c should use a better cron-script
for mobile computers
Michelle Konzack
linux4michelle at freenet.de
Mon Mar 5 17:24:57 CET 2007
Package: popularity-contest
Version: 1.33
Severity: wishlist
Hello Maintainer,
I run several Laptops and other Mobil-Computers with popularity-
contest but unfortunatly the scripts are never executed.
What I have currently done is a script which is called all 15
minutes and check whether it has (in the last 7 days) send a
pop-con submission and if not, it create and send it.
It would be nice, if you can cleanly implement it specialy for
Mobile-Computers. I think, debconf can be used to (de)activate
the script in /etc/cron.weekly/popularity-contest and use instead
a /etc/cron.d/popularity-contest job.
E.g.:
----[ '/etc/cron.d/popularity-contest' ]-------------------------------
*/15 * * * * /etc/cron.weekly/popularity-contest foo
-----------------------------------------------------------------------
and
----[ '/etc/cron.weekly/popularity-contest' ]--------------------------
#!/bin/sh
# don't run if this package is removed but not purged
if [ ! -f /usr/sbin/popularity-contest ]; then
exit 0
fi
unset MAILFROM
unset MAILTO
unset MY_HOSTID
unset PARTICIPATE
# get configuration information
. /usr/share/popularity-contest/default.conf
. /etc/popularity-contest.conf
# Check, whether we run mobile and if called from cron.d
if [ "${MOBILE}" = "true" ] && [ -z "$1" ] ; then exit 0 ; fi
# Check, whether the delay between two calls is greater then
# 7 days (604800 seconds)
if [ "${MOBILE}" = "true" ] ; then
OLDTIME=$(cat /var/lib/popularity-contest/lastrun 2>/dev/null)
NEWTIME=$(date +%s)
DIFTIME=$((NEWTIME-OLDTIME))
if [ ${DIFTIME} -lt 604800 ] ; then exit 0 ; fi
echo "${NEWTIME}" >/var/lib/popularity-contest/lastrun
fi
<snip>
-----------------------------------------------------------------------
and for the to "debconf" added VALUE ${MOBILE}
----[ '/etc/popularity-contest.conf' ]---------------------------------
MY_HOSTID="7a500ea53cd746e7b10608044eb387a2"
PARTICIPATE="yes"
MAILTO="survey at popcon.debian.org, XXXXXXXXX.XXXXXXX.XXXXX at freenet.de"
MAILFROM="XXXXXXXXX.XXXXXXX.XXXXX at freenet.de"
MOBILE="true"
-----------------------------------------------------------------------
which mean, the pop-con script will only run, if
1) the value of MOBILE is "false" and $1 is empty (which is the case
if it run from /etc/cron.weekly/popularity-contest
2) if calue of MOBILE is true and $1 is anything but not empty (which
is the case if run from '/etc/cron.d/popularity-contest')
Thanks, Greetings and nice Day
Michelle Konzack
Systemadministrator
Tamay Dogan Network
Debian GNU/Linux Consultant
-- System Information
Debian Release: testing/unstable
Kernel Version: Linux samba3.private 2.4.27-2-386 #1 Wed Nov 30 21:38:51 JST 2005 i686 GNU/Linux
Versions of the packages popularity-contest depends on:
ii debconf 1.5.3 Debian configuration management system
ii dpkg 1.13.21 package maintenance system for Debian
debconf Version: 1.5.3 (Provides virtual package debconf-2.0)
ii debconf 1.5.3 Debian configuration management system
^^^ (Provides virtual package debconf-2.0)
dpkg-awk Not installed or no info
--
Linux-User #280138 with the Linux Counter, http://counter.li.org/
##################### Debian GNU/Linux Consultant #####################
Michelle Konzack Apt. 917 ICQ #328449886
50, rue de Soultz MSM LinuxMichi
0033/6/61925193 67100 Strasbourg/France IRC #Debian (irc.icq.com)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.alioth.debian.org/pipermail/popcon-developers/attachments/20070305/434b0e4c/attachment.pgp
More information about the Popcon-developers
mailing list