From ac1820e72ec14b31fc751fb2482a0d31caed21ba Mon Sep 17 00:00:00 2001 From: "martin f. krafft" Date: Tue, 20 Nov 2007 19:36:01 +0100 Subject: [PATCH] improved traps, now db calls log errors --- procmail/logging | 4 ++-- procmail/msgid-index | 6 ++++-- procmail/record-delayed-mail | 7 ++++--- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/procmail/logging b/procmail/logging index a606b2a..842cd9a 100644 --- a/procmail/logging +++ b/procmail/logging @@ -21,7 +21,7 @@ original-to: $ORIGINAL_TO subject: $SUBJECT$NL" TRAP="DESTFILE=\"\${LASTFOLDER#$BASE/}\"; - echo >> '$THISLOGFILE'; - egrep -v '^XX(procmail:)?[[:space:]\"]' '$THISLOGFILE' >> $MASTERLOGFILE" + trap \"echo >> '$THISLOGFILE'; + cat '$THISLOGFILE' >> $MASTERLOGFILE\" 0" #VERBOSE=yes diff --git a/procmail/msgid-index b/procmail/msgid-index index 67606fa..0f300a2 100644 --- a/procmail/msgid-index +++ b/procmail/msgid-index @@ -14,8 +14,10 @@ DATA="$FROM,$NL$ORIGINAL_TO,$NL$SUBJECT,$NL$MSGID" INCLUDERC=$PMDIR/sql-escape QUERY="insert into messages (sender, recipient, subject, msgid, filename, dest) values ( - $DATA, '\\'$THISLOGFILE_REL\\'', '\\'\$DESTFILE\\'')" -TRAP="$TRAP; $DO_QUERY '$QUERY'" + $DATA, '\\'$THISLOGFILE_REL\\'', '\\'\$DESTFILE\\''); + select * from messages where filename = '\\'$THISLOGFILE_REL\\''" +TRAP="$TRAP; case \"$($DO_QUERY '$QUERY')\" in '') + echo 'msgid-index: failed to insert reference into database';; esac" QUERY DATA diff --git a/procmail/record-delayed-mail b/procmail/record-delayed-mail index e83391b..72ff6b8 100644 --- a/procmail/record-delayed-mail +++ b/procmail/record-delayed-mail @@ -8,9 +8,10 @@ DO_QUERY="$SQLITE $DELAYED_QUEUE_DB" DATA="$MSGID" INCLUDERC=$PMDIR/sql-escape -QUERY="insert into messages values - ($DATA, '\\'\$DESTFILE\\'', $RELEASE_TS)" -TRAP="$TRAP; $DO_QUERY '$QUERY'" +QUERY="insert into messages values ($DATA, '\\'\$DESTFILE\\'', $RELEASE_TS); + select * from messages where msgid = $DATA" +TRAP="$TRAP; case \"$($DO_QUERY '$QUERY')\" in '') + echo 'delay: failed to insert reference into database';; esac" QUERY DATA -- 2.39.5