dspam Package does not contain cron'ed execution of dspam_logrotate.

Bug #111640 reported by Remi Broemeling
2
Affects Status Importance Assigned to Milestone
dspam (Ubuntu)
Fix Released
Wishlist
Unassigned

Bug Description

Binary package hint: dspam

In the dspam documentation, under "NIGHTLY MAINTENANCE AND HOUSEKEEPING CRONS", the need for running dspam_logrotate on a regular basis is noted:

>Log Rotation
>
> The system log and user logs can fill up fairly quickly, when all that's
> really needed to generate graphs are the last two to three weeks of data.
> You can configure a nightly log cleanup using dspam_logrotate:
>
> 0 0 * * * dspam_logrotate -a 30 -d /usr/local/var/dspam/data

I couldn't find a script/cron'ed instance of this in the scripts and configuration installed by the package, so I wrote one in /etc/cron.daily/dspam_logrotate:

#!/bin/sh
#
# Rotate DSPAM's data files as suggested by the DSPAM documentation.

DSPAMCONF=/etc/dspam/dspam.conf
DSPAMHOME="`grep -i "^Home" $DSPAMCONF | awk '{print $2}'`"

if [ -n "$DSPAMHOME" -a -e "$DSPAMHOME/data" ]; then
  SYSTEMLOG="`grep -i "^SystemLog" $DSPAMCONF | awk '{print $2}' | tr '[:upper:]' '[:lower:]'`"
  USERLOG="`grep -i "^UserLog" $DSPAMCONF | awk '{print $2}' | tr '[:upper:]' '[:lower:]'`"

  if [ "$SYSTEMLOG" = "on" -o "$USERLOG" = "on" ]; then
    if [ -x /usr/bin/dspam_logrotate ]; then
      /usr/bin/dspam_logrotate -a 45 -d "$DSPAMHOME/data"
    fi
  fi
fi

exit 0

Tags: patch
Revision history for this message
Remi Broemeling (remi-nexopia) wrote :

Whoops. I had the wrong directory being passed to dspam_logrotate. It should take DSPAM home.

#!/bin/sh
#
# Rotate DSPAM's data files as suggested by the DSPAM documentation.

DSPAMCONF=/etc/dspam/dspam.conf
DSPAMHOME="`grep -i "^Home" $DSPAMCONF | awk '{print $2}'`"

if [ -n "$DSPAMHOME" -a -e "$DSPAMHOME" ]; then
  SYSTEMLOG="`grep -i "^SystemLog" $DSPAMCONF | awk '{print $2}' | tr '[:upper:]' '[:lower:]'`"
  USERLOG="`grep -i "^UserLog" $DSPAMCONF | awk '{print $2}' | tr '[:upper:]' '[:lower:]'`"

  if [ "$SYSTEMLOG" = "on" -o "$USERLOG" = "on" ]; then
    if [ -x /usr/bin/dspam_logrotate ]; then
      /usr/bin/dspam_logrotate -a 45 -d "$DSPAMHOME"
    fi
  fi
fi

exit 0

Daniel Hahler (blueyed)
Changed in dspam:
importance: Undecided → Wishlist
Julien Valroff (julienv)
Changed in dspam (Ubuntu):
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.