[Logcheck-commits] CVS logcheck/debian

CVS User eevans-guest logcheck-devel@lists.alioth.debian.org
Tue, 18 May 2004 13:52:39 -0600


Update of /cvsroot/logcheck/logcheck/debian
In directory haydn:/tmp/cvs-serv6555

Modified Files:
	changelog logcheck.config logcheck.postinst logcheck.templates 
Log Message:
- Added a debconf dialog to prompt users, (priority low), to select one of
  hourly, daily, or weekly for the cron-job. Defaults to hourly.

-- Eric Evans


--- /cvsroot/logcheck/logcheck/debian/changelog	2004/05/18 08:55:04	1.81
+++ /cvsroot/logcheck/logcheck/debian/changelog	2004/05/18 19:52:39	1.82
@@ -24,11 +24,13 @@
   * Made addition of logcheck user and permissions/ownership changes a
     conditional of an upgrade from a version less than 1.2.19,
     (Closes: #249324).
+  * Prompt with debconf, (priority low), for the frequency to run 
+    logcheck, (Closes: #222240, #226937). 
   alfie:
   * src/logcheck: test also for readability for the header.txt and footer.txt.
   * debian/changelog: stripped all trailing whitespace from the file.
 
- -- 
+ --
 
 logcheck (1.2.20a) unstable; urgency=low
 
--- /cvsroot/logcheck/logcheck/debian/logcheck.config	2004/05/13 12:47:14	1.5
+++ /cvsroot/logcheck/logcheck/debian/logcheck.config	2004/05/18 19:52:39	1.6
@@ -11,11 +11,13 @@
 
 
 db_text medium logcheck/install-note || true
-db_go
 
 if [ -n "$version" ] && dpkg --compare-versions "$version" lt "1.2.3"; then
     db_text medium logcheck/changes || true
-    db_go
 fi
 
+db_input low logcheck/cron || true
+
+db_go || true
+
 exit 0
--- /cvsroot/logcheck/logcheck/debian/logcheck.postinst	2004/05/16 21:19:56	1.11
+++ /cvsroot/logcheck/logcheck/debian/logcheck.postinst	2004/05/18 19:52:39	1.12
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-# $Id: logcheck.postinst,v 1.11 2004/05/16 21:19:56 eevans-guest Exp $
+# $Id: logcheck.postinst,v 1.12 2004/05/18 19:52:39 eevans-guest Exp $
 
 set -e
 
@@ -25,6 +25,26 @@
 # Source debconf library.
 . /usr/share/debconf/confmodule
 
+# Update the logcheck crontab to one of the alternate intervals
+update_crontab()
+{
+    CRONTAB=/etc/cron.d/logcheck
+    TMPCRON=`mktemp /var/tmp/logcheck-cron.XXXXXX`
+    
+    if [ -f $CRONTAB ] && [ "$1" == "daily" ] ; then
+        sed -e "s/^[[:digit:]*,-/]\+[[:space:]]\+[[:digit:]*,-/]\+[[:space:]]\+[[:digit:]*,-/]\+[[:space:]]\+[[:alnum:]*,-/]\+[[:space:]]\+[[:alnum:]*,-/]\+\([[:space:]]\+.\+ \/usr\/sbin\/logcheck .\+$\)/2 0 * * *\1/g" $CRONTAB > $TMPCRON
+	cp $TMPCRON $CRONTAB
+	chown 644 $CRONTAB
+    fi
+    
+    if [ -f $CRONTAB ] && [ "$1" == "weekly" ] ; then
+        sed -e "s/^[[:digit:]*,-/]\+[[:space:]]\+[[:digit:]*,-/]\+[[:space:]]\+[[:digit:]*,-/]\+[[:space:]]\+[[:alnum:]*,-/]\+[[:space:]]\+[[:alnum:]*,-/]\+\([[:space:]]\+.\+ \/usr\/sbin\/logcheck .\+$\)/2 0 1 * *\1/g" $CRONTAB > $TMPCRON
+	cp $TMPCRON $CRONTAB
+	chown 644 $CRONTAB
+    fi
+    rm -f $TMPCRON
+}
+
 case "$1" in
     configure)
 	# Remove old directory's
@@ -57,6 +77,16 @@
           chown logcheck /var/lock/logcheck &> /dev/null || true
 	fi
 
+	db_get logcheck/cron
+	CRON="$RET"
+	case "$RET" in
+	    daily)
+	        update_crontab daily
+            ;;
+	    weekly)
+	        update_crontab weekly
+	    ;;

[4 lines skipped]
--- /cvsroot/logcheck/logcheck/debian/logcheck.templates	2004/05/07 07:24:21	1.6
+++ /cvsroot/logcheck/logcheck/debian/logcheck.templates	2004/05/18 19:52:39	1.7
@@ -20,3 +20,13 @@
  directories.
  .
  Please see /usr/share/doc/logcheck for more details.
+
+Template: logcheck/cron
+Type: select
+Choices: weekly, daily, hourly
+Default: hourly
+_Description: How often should logcheck run to generate reports?
+ Logcheck is invoked by cron to periodically parse your log files and 
+ generate an email report. Hourly is the default and recommended 
+ interval for this, but you may also select from one of weekly or daily
+ as well.