]> 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:

delay retrains until tonight
[etc/mailfilter.git] / procmail / logging
1 LOGABSTRACT=no
2
3 MSGIDDIR=$PMVAR/msgid
4
5 :0
6 * MSGID ?? ^<\/[^>]+
7 {
8   MSGID_NAME=`echo $MATCH | tr -d "'\"?[:cntrl:]" | tr ' /*$' '__+S'`
9
10   #VERBOSE=yes
11   # check if filename > 228 characters and if so, then shorten it to prevent
12   # hitting filesystem limit after we append the timestamp
13   :0
14   * MSGID_NAME ?? ^.....................................................................................................................................................................................................................................
15   {
16     HASH=`echo $MSGID_NAME | md5sum | cut -d' ' -f1`
17     MSGID_NAME=`echo $MSGID_NAME | cut -c-196`$HASH
18   }
19
20   THISLOGFILE_REL=$MSGID_NAME%$OURDATE_SHORT
21   THISLOGFILE="$MSGIDDIR/$THISLOGFILE_REL"
22
23   MSGID_NAME
24   #VERBOSE=no
25 }
26
27 MASTERLOGFILE="$LOGFILE"
28 LOGFILE="$THISLOGFILE"
29
30 LOG="==============================================================================$NL"
31
32 :0
33 * LOGLATER ?? .
34 { LOG="$LOGLATER" }
35
36 LOG="msgid:       $MSGID
37 logfile:     $THISLOGFILE_REL
38 date:        $DATE (@$OURDATE)
39 from:        $FROM
40 original-to: $ORIGINAL_TO
41 subject:     $SUBJECT$NL"
42
43 TRAP="DESTFILE=\"\${LASTFOLDER#$BASE/}\";
44       /usr/bin/lockfile -4 -r50 -l180 $PMVAR/lock;
45       trap \"echo >> '$THISLOGFILE';
46              /bin/cat '$THISLOGFILE' >> $MASTERLOGFILE;
47              /bin/rm -f $PMVAR/lock\" 0"
48
49 THISLOGFILE_REL