create new tag
, view all tags


Duplicate notifications from MailerContrib for some, but not all users. Why?

[Detail not relevant to the solution removed in final update.]

7 0 * * * /var/www/twiki/tools/runmailnewsnotify
7 0 * * * /var/www/twiki/tools/runmailwebnotify

cat /var/www/twiki/tools/runmailnewsnotify
cd /var/www//twiki && /usr/bin/perl -I bin tools/mailnotify -q -news '*'

cat /var/www/twiki/tools/runmailwebnotify
cd /var/www//twiki && /usr/bin/perl -I bin tools/mailnotify -q '*'

Note: MailerContrib was updated to latest version 01-Apr-2008; no change.

Any clues would be appreciated...


TWiki version: TWikiRelease04x01x02
TWiki plugins: CalendarPlugin, CleanupRemoteUserPlugin, CommentPlugin, EditTablePlugin, ImageGalleryPlugin, InterwikiPlugin, PreferencesPlugin, RenderListPlugin, SlideShowPlugin, SmiliesPlugin, SpreadSheetPlugin, SubscribePlugin, TablePlugin, TwistyPlugin
Server OS: Fedora Core 6 -
Web server: Apache
Perl version: 5.8.8
Client OS: XP SP2
Web Browser: IE7
Categories: Plugins

-- TimotheLitt - 02 Apr 2008


ALERT! If you answer a question - or someone answered one of your questions - please remember to edit the page and set the status to answered. The status selector is below the edit box.

Closing this question after more than 30 days due to inactivity. Please feel free to reopen if needed.

-- PeterThoeny - 11 May 2008

Well, I still could use some help - the problem is still there. I think I provided as much useful information as possible.

Is there a better place to ask?

-- TimotheLitt - 12 May 2008

This is the right place. You could add a pointer to this open question in the MailerContribDev topic.

-- PeterThoeny - 13 May 2008

Try this: Please do not run both commands at the same time. According to your crontab, runmailwebnotify is invoked while runmailnewsnotify is still running.

In otherwords, crontab should be one line:

7 0 * * * /var/www/twiki/tools/runmailnotify 

And runmailnotify should be

#!/bin/bash /var/www/twiki/tools/runmailnewsnotify /var/www/twiki/tools/runmailwebnotify 
Or even,
#!/bin/bash  cd /var/www//twiki && /usr/bin/perl -I bin tools/mailnotify -q -news '*'  cd /var/www//twiki && /usr/bin/perl -I bin tools/mailnotify -q '*'  

-- GilbertHerschberger - 20 May 2008

Thanks for the hint!

This restriction wasn't obvious from the documentation - in fact, the installation instructions have a heading talking about "creating your cron job(s)".

Seems like an interlock is missing in the code - shouldn't be the user's job to manage synchronization.

Here is the final resolution. I consolidated all the maintenance into a single cron job/script. This eliminated the duplicate notifications.

The script can be run several times a day if frequent notifications are desired; it will run weekly processing only once /wk and daily processing only once a day - on selectable day/time. (I run the old wrapper scripts for convenience when manually forcing an update; one could in-line them if desired.)

You might want to use this as an example in the documention or include it in the distribution. Nonetheless, the lack of synchronization seems like a bug.


# # Daily wiki maintenance - 0007 #   -d debug, Day of week for weekly activities, hour for daily # 7 0 * * * /var/www/twiki/tools/twiki_maintenance Mon 00 


# Run TWiki maintenance tasks sequentially
# Independent crontab entries may run in parallel
# and produce duplicate notifications per
# http://twiki.org/cgi-bin/view/Support/DuplicateNotificationsFromMailerCon
# One crontab entry runs this periodically
PG=`basename $0`
TOOLS=`dirname $0`
NOW=`date +"%a|%H"`
TODAY=`echo $NOW  | sed -e 's/^\(.*\)|\(.*\)$/\1/'`
HR_NOW=`echo $NOW | sed -e 's/^\(.*\)|\(.*\)$/\2/'`
# -d = enable debug messages
if [ "$1" = "-d" ]; then
# $1 = Day of week (Mon ... Sun) to do weekly processing
if [ -z "$WKLY_DAY" ]; then WKLY_DAY="$TODAY" ; fi
# $2 = Hour (00-23) to do daily & weekly processing
#      (Other hours do hourly only)
if [ -z "$WKLY_HR" ]; then WKLY_HR="$HR_NOW" ; fi
# Output debug message
function Debug () {
    if [ -n "$DEBUG" ]; then
        echo "`date` [$PG] $*"
Debug "Running on $TODAY @ $HR_NOW:xx"
# Stuff to do every day
if [ "$HR_NOW" -eq "$WKLY_HR" ]; then
    # Daily at specified hour
    Debug "Running statistics"

    if [ "$TODAY" = "$WKLY_DAY" ]; then
        # Weekly processing
        Debug "Running ticktwiki"
# Every hour that cron runs this script
Debug "Running newsnotify"

Debug "Running webnotify"

# [End of file]

-- TimotheLitt - 14 Jul 2008

Making a lock may be a good idea but implemented the wrong way it a crash of code can mean that nothing will work again in a dead lock so who ever decides to make a lock must make it fool proof.

-- KennethLavrsen - 14 Jul 2008

Upgrading to new twki and realized that my example had hardcoded the tools directory. Updated to figure it out at runtime. Perhaps it will help someone else.

-- TimotheLitt - 14 Oct 2008

Change status to:
Edit | Attach | Watch | Print version | History: r9 < r8 < r7 < r6 < r5 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r9 - 2008-10-14 - TimotheLitt
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2018 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.