]> git.madduck.net Git - etc/mailfilter.git/blob - procmail/logging

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

use hashed directory for msgid dir
[etc/mailfilter.git] / procmail / logging
1 LOGABSTRACT=no
2
3 MSGIDDIR=$PMVAR/msgid
4
5 :0
6 * MSGID ?? ^<\/[^>]+
7 {
8   MSGID_NAME=`echo $MATCH | sha224sum | cut -d' ' -f1`
9
10   :0
11   * MSGID_NAME ?? ^\/.
12   { HASH1="$MATCH" }
13
14   :0
15   * MSGID_NAME ?? ^.\/.
16   { HASH2="$MATCH" }
17
18   THISLOGFILE_REL=${MSGID_NAME}_${OURDATE_SHORT}
19   LOGDIR="${MSGIDDIR}/${HASH1}/${HASH2}"
20
21   VERBOSE=yes
22
23   MKDIR=`test -d $LOGDIR || mkdir -p $LOGDIR`
24   MKDIR
25
26   THISLOGFILE="${LOGDIR}/${THISLOGFILE_REL}"
27
28   VERBOSE=no
29
30   LOGDIR
31   HASH2
32   HASH1
33   MSGID_NAME
34 }
35
36 MASTERLOGFILE="$LOGFILE"
37 LOGFILE="$THISLOGFILE"
38
39 LOG="==============================================================================$NL"
40
41 :0
42 * LOGLATER ?? .
43 { LOG="$LOGLATER" }
44
45 LOG="msgid:       $MSGID
46 logfile:     $THISLOGFILE_REL
47 date:        $DATE (@$OURDATE)
48 sender:      $SENDER
49 from:        $FROMEMAIL ($FROM)
50 original-to: $ORIGINAL_TO
51 subject:     $SUBJECT$NL"
52
53 TRAP="DESTFILE=\"\${LASTFOLDER#$BASE/}\";
54       /usr/bin/lockfile -4 -r50 -l180 $PMVAR/lock;
55       trap \"echo >> '$THISLOGFILE';
56              /bin/cat '$THISLOGFILE' >> $MASTERLOGFILE;
57              /bin/rm -f $PMVAR/lock\" 0"
58
59 THISLOGFILE_REL