MH & nmh: Email for Users & Programmers

May, 2006

Explanation of drmm

The page you're reading has details about the drmm shell script. The page Delayed Removal: drmm gives an overview of this script. Here is the drmm script (you might want to open it in a separate browser window). To install it, first see the Section Programs in This Book's Archive and create the file drmm.

drmm adds an X-Remove-After: header field like the one on the first line of this message:

    X-remove-after: 6 may 1997
    Date: Sun, Apr 20 20:22:09 MDT 1997
    To: majordomo-workers@GreatCircle.COM
This field is a flag for a simple cron job that searches all messages in all folders for X-Remove-After: fields and removes them if they're dated today or before. The scan.drmm format file also shows this date.

The script needs a litte configuration to choose the version of echo in your shell or system; the lines are at the top. The rest of the script is fairly straightforward.

Here is the scan.drmm file. It's a scan format file that checks each message for an X-Remove-After: field (which marks a delayed-removal message). Otherwise, it's the same as the default MH scan format file. If you use drmm much, you may want to make this your default scan format file; to do that, put this entry in your MH profile:

    scan: -form scan.drmm
Or, you can make a shell alias or function, or a command version, to do that when you want it by typing a command like dscan.

Here is the drmmer script (again, you might want to open it in a separate browser window). It's just a shell loop that steps through all your folders, using pick to find removable messages and rmm to remove them. It gives a summary of what it's doing, like this:

                    bug-mh+ has   74 messages (   1-  77); cur=  75; (others).
                    drafts+ has   17 messages (   1-  26); cur=  26; (others).
                     inbox+ has   70 messages (   1-  79); cur=  59; (others).
    drmmer removing: 
      81 R02/06 01/20 To:Xavier Viaud    Read my email next week?<<Xavier, I'll
      89 R02/06 01/21 Xavier Viaud       Re: Read my email next week?<<Jerry, n
                      jobs+ has   no messages            ;           (others).
    pick: no messages in jobs
                  jobs/dci+ has   17 messages (   1-  17); cur=  17; (others).
                  jobs/ora+ has   68 messages (   1- 722); cur= 704; (others).
If you need help setting it up, see the Section Periodic Cleanup, Checking, etc. with cron and at.