mail_usemod_changes [config_file]

A script to read usemod wiki's RSS feed and email all (not previously notified) recent changes to an email address. It keeps track of any changes it has already reported, so only reports 'new' recent changes, and sends no email at all if nothing has changed since last time it was run.

It's designed to be run from cron, at whatever interval you'd like to be kept informed of changes to your wiki.

It takes one optional argument - if present, this is the path to the configuration file to use; if absent, mail_usemod_changes will attempt to read the default configuration file (/usr/local/etc/mail_usemod_changes.conf).

The following is an example of an email it produces (with the To, From lines cut):

 Subject: My Wiki Recent Changes
 Home
   continue front page simplification
     29 November 2003 12:21:38 -- Mk
     http://www.mywiki.notcom/wiki/wiki.pl?Home
 AboutThisWiki
   front page tidyup
     29 November 2003 12:20:20 ** Mk
     http://www.mywiki.notcom/wiki/wiki.pl?AboutThisWiki

Each page gets a paragraph, with the following format:

 page name
   [ Description of change, if entered ]
     Time of change (**/--) Username
     URL to page

The significance of the revision is indicated by the **/-- indicator: ** for major revisions, -- for minor ones.

The URL is designed to be clickable from mail clients that automatically create symlinks to 'http://...' and trivially cut and pastable into a browser from those that do not. Mail clients that insist on angle brackets around URLs before making them clickable suck (since by so doing they make said URLs non-trivially cut and pastable) and are, therefore, not of interest.

FILES

/usr/local/etc/mail_usemod_changes.conf - the configuration file that will be used if one is not specified on the command line.

CONFIGURATION FILE FORMAT

The configuration file consists of a number of key value pairs, one pair per line, with the keys and values separated by an equals sign '=' and any amount of whitespace. The following keys are required:

mail_to
the email address to which the report should be sent

mail_from
the email address from which the report should be sent

reply_to
The reply-to address - set to '0' if you don't wish to set one.

subject
Subject for the email

footer
Footer text that will be appended to the email. Each occurence of '\n' in the footer text will be replaced with a new line.

mail_server
Hostname of the SMTP server to which to send the email

cache_file
The full path to the cache file in which mail_usemod_changes will keep a record of the changes it has already seen.

fetch_rss
A command that will produce the RSS feed of the WIKI concerned on stdout. See the section ``SETTING fetch_rss'' below for details.

debug
0 - no debugging output. Guess what 1 does...

SETTING fetch_rss

fetch_rss should be set to a command that will retrieve the RSS feed from the Wiki you are interested in and print it on standard output. For example:

fetch_rss = wget --quiet -O - http://wiki.somewhere.foo/wiki.pl?action=rss

This will fetch the default RSS feed from the somewhere.foo wiki. Much of the time, this will be exactly what you want.

You may find, however, that the default RSS feed is not to your taste; you may wish to be told about minor changes, or even every single revision (not just the most recent). In this case, use an ordinary browser to set UseModWiki's preferences and to obtain the cookie set by UseModWiki, and pass that to wget, as in the example below:

fetch_rss = wget --quiet --cookies=off --header=``Cookie: mywiki=rev&1&id&5001&randkey&123123123'' -O - http://wiki.somewhere.foo/wiki.pl?action=rss

AUTHOR

Julian T. J. Midgley <jtjm@xenoclast.org>