The cron job for optimizing/purging DSPAM data in MySQL does not honor the new mysql_purge-4.1.sql script. I know that this is my error, since I wrote the original dspam.cron script. Anyway... the script needs changes and should probably look like this: #!/bin/bash # Remove old signatures and unimportant tokens from the DSPAM database for foo in awk head tail do DSPAM_Check_App="$(${foo} --version 2>&1)" if [[ "${DSPAM_Check_App/ *}" == "bash:" ]] then echo "Command ${foo} not found." exit 1 fi done DSPAM_HOMEDIR="$(grep ^dspam /etc/passwd|awk -F : '{print $6}')" [[ ! -d "${DSPAM_HOMEDIR}" ]] && exit 2 if [[ -f "${DSPAM_HOMEDIR}/mysql.data" ]] then DSPAM_MySQL_PURGE_SQL="" DSPAM_MySQL_VER="$(mysql_config --version)" case "${DSPAM_MySQL_VER:0:3}" in "4.0") [[ -f "${DSPAM_HOMEDIR}/config/mysql_purge.sql" ]] && DSPAM_MySQL_PURGE_SQL="${DSPAM_HOMEDIR}/config/mysql_purge.sql" [[ -f "${DSPAM_HOMEDIR}/mysql_purge.sql" ]] && DSPAM_MySQL_PURGE_SQL="${DSPAM_HOMEDIR}/mysql_purge.sql" ;; "4.1" | "5.0" ) [[ -f "${DSPAM_HOMEDIR}/config/mysql_purge-4.1.sql" ]] && DSPAM_MySQL_PURGE_SQL="${DSPAM_HOMEDIR}/config/mysql_purge-4.1.sql" [[ -f "${DSPAM_HOMEDIR}/mysql_purge-4.1.sql" ]] && DSPAM_MySQL_PURGE_SQL="${DSPAM_HOMEDIR}/mysql_purge-4.1.sql" ;; *) echo "Unknown/unsupported MySQL Version ${DSPAM_MySQL_VER}" ;; esac [[ "${DSPAM_MySQL_PURGE_SQL}" == "" ]] && exit 3 [[ ! -f "/usr/bin/mysql" ]] && exit 4 DSPAM_MySQL_HOST="$(cat ${DSPAM_HOMEDIR}/mysql.data|head -n 1|tail -n 1)" DSPAM_MySQL_PORT="$(cat ${DSPAM_HOMEDIR}/mysql.data|head -n 2|tail -n 1)" DSPAM_MySQL_USER="$(cat ${DSPAM_HOMEDIR}/mysql.data|head -n 3|tail -n 1)" DSPAM_MySQL_PWD="$(cat ${DSPAM_HOMEDIR}/mysql.data|head -n 4|tail -n 1)" DSPAM_MySQL_DB="$(cat ${DSPAM_HOMEDIR}/mysql.data|head -n 5|tail -n 1)" (/usr/bin/mysql -u ${DSPAM_MySQL_USER} -p"${DSPAM_MySQL_PWD}" ${DSPAM_MySQL_DB} < ${DSPAM_MySQL_PURGE_SQL}) 1>/dev/null 2>&1 MYRC="$?" for foo in $(/usr/bin/mysql -u ${DSPAM_MySQL_USER} -p"${DSPAM_MySQL_PWD}" ${DSPAM_MySQL_DB} -e 'SHOW TABLES;' 2>&1 | grep -v "^+\|^Tables_in_${DSPAM_MySQL_DB}") do (/usr/bin/mysql -u ${DSPAM_MySQL_USER} -p"${DSPAM_MySQL_PWD}" ${DSPAM_MySQL_DB} -e "OPTIMIZE TABLE ${foo};") 1>/dev/null 2>&1 done exit ${MYRC} elif [[ -f "${DSPAM_HOMEDIR}/pgsql.data" ]] then DSPAM_PgSQL_PURGE_SQL="" [[ -f "${DSPAM_HOMEDIR}/config/pgsql_purge.sql" ]] && DSPAM_PgSQL_PURGE_SQL="${DSPAM_HOMEDIR}/config/pgsql_purge.sql" [[ -f "${DSPAM_HOMEDIR}/pgsql_purge.sql" ]] && DSPAM_PgSQL_PURGE_SQL="${DSPAM_HOMEDIR}/pgsql_purge.sql" [[ "${DSPAM_PgSQL_PURGE_SQL}" == "" ]] && exit 3 [[ ! -f "/usr/bin/psql" ]] && exit 4 DSPAM_PgSQL_HOST="$(cat ${DSPAM_HOMEDIR}/pgsql.data|head -n 1|tail -n 1)" DSPAM_PgSQL_PORT="$(cat ${DSPAM_HOMEDIR}/pgsql.data|head -n 2|tail -n 1)" DSPAM_PgSQL_USER="$(cat ${DSPAM_HOMEDIR}/pgsql.data|head -n 3|tail -n 1)" DSPAM_PgSQL_PWD="$(cat ${DSPAM_HOMEDIR}/pgsql.data|head -n 4|tail -n 1)" DSPAM_PgSQL_DB="$(cat ${DSPAM_HOMEDIR}/pgsql.data|head -n 5|tail -n 1)" (PGUSER=${DSPAM_PgSQL_USER} PGPASSWORD=${DSPAM_PgSQL_PWD} /usr/bin/psql -U ${DSPAM_PgSQL_USER} -d ${DSPAM_PgSQL_DB} -p ${DSPAM_PgSQL_PORT} -h ${DSPAM_PgSQL_HOST} -f ${DSPAM_PgSQL_PURGE_SQL}) 1>/dev/null 2>&1 exit $? elif [[ -f "${DSPAM_HOMEDIR}/oracle.data" ]] then DSPAM_Oracle_PURGE_SQL="" [[ -f "${DSPAM_HOMEDIR}/config/ora_purge.sql" ]] && DSPAM_Oracle_PURGE_SQL="${DSPAM_HOMEDIR}/config/ora_purge.sql" [[ -f "${DSPAM_HOMEDIR}/ora_purge.sql" ]] && DSPAM_Oracle_PURGE_SQL="${DSPAM_HOMEDIR}/ora_purge.sql" [[ "${DSPAM_Oracle_PURGE_SQL}" == "" ]] && exit 3 [[ ! -f "/usr/bin/sqlplus" ]] && exit 4 DSPAM_Oracle_DBLINK="$(cat ${DSPAM_HOMEDIR}/oracle.data|head -n 1|tail -n 1)" DSPAM_Oracle_USER="$(cat ${DSPAM_HOMEDIR}/oracle.data|head -n 2|tail -n 1)" DSPAM_Oracle_PWD="$(cat ${DSPAM_HOMEDIR}/oracle.data|head -n 3|tail -n 1)" DSPAM_Oracle_SCHEMA="$(cat ${DSPAM_HOMEDIR}/oracle.data|head -n 4|tail -n 1)" (/usr/bin/sqlplus -s ${DSPAM_Oracle_USER}/${DSPAM_Oracle_PWD} @${DSPAM_Oracle_PURGE_SQL}) 1>/dev/null 2>&1 exit $? else [[ ! -f "/usr/bin/dspam_clean" ]] && exit 4 /usr/bin/dspam_clean -s -p -u 1>/dev/null 2>&1 exit $? fi
Created attachment 78131 [details] mail-filter/dspam/files/dspam.cron Ouch! When I created the dspam.cron file, then the home directory in passwd for dspam was /etc/mail/dspam. Now the new home is /var/spool/dspam. The dspam.cron file as it is today would never ever execute the MySQL / PostgreSQL / Oracle purge SQL scripts, since it would not find the *.data files in /var/spool/dspam. I changed this now in the attached dspam.cron file. Sorry for the error. cheers SteveB
Included in the latest dspam-3.6.4