[SWLUG] Carmarthen meeting reminder - TONIGHT

Dafydd Walters dafydd at walters-home.net
Tue Jan 15 20:40:50 UTC 2008


Unfortunately, I can't make it tonight - working late in Cardiff.

Daniel Morris wrote:
> The meeting is scheduled for the third Tuesday of each month, and we
> seem to take it in turns to send out reminders ;-)  Korganiser handles
> the recurrence fine, but cron is a bit more tricky...

Unfortunately, broadband problems (brought on by the bad weather, I
reckon), have prevented the usual automated reminder my PC normally
sends out.

For anyone who's interested, the cron job I set up for the reminders
just runs the script below every day. I've added the following two lines
to cron to make it happen:

0 4 * * *>..>.../home/dafydd/bin/swlug-reminder 'Mon' 15 21 'Carmarthen'
'Tuesday'

5 4 * * *>..>.../home/dafydd/bin/swlug-reminder 'Tue' 1 7 'Cardiff'
'Wednesday'



#!/usr/bin/env bash
#
# Script :swlug-reminder
#
############################################
# Configuration parameters:

SENDER='dafydd at walters-home.net'
RECIPIENTS='discuss at swlug.org announce at swlug.org'
SEND_DAY_OF_WEEK=$1
SEND_LOWEST_DAY_OF_MONTH=$2
SEND_HIGHEST_DAY_OF_MONTH=$3
VENUE=$4
DAY_OF_MEETING=$5

#############################################

function send_mail()
{
>.../usr/sbin/sendmail -f $SENDER -t << EOF
Reply-To: $SENDER
Subject: SWLUG $VENUE Meeting Reminder
To: $1
Content-type: text/plain

This is a reminder than the next SWLUG meeting in $VENUE
will be held tomorrow (${DAY_OF_MEETING}) at 7PM.
See the http://swlug.org web site for details.
--
This automated message was brought to you by cron.
EOF
}

DAY_OF_WEEK=$(date '+%a')
DAY_OF_MONTH=$(date '+%d')

if [ "$DAY_OF_WEEK" == $SEND_DAY_OF_WEEK -a $DAY_OF_MONTH -ge
$SEND_LOWEST_DAY_OF_MONTH -a $DAY_OF_MONTH -le $SEND_HIGHEST_DAY_OF_MONTH ]
then
>...for R in $RECIPIENTS
>...do
>...>...send_mail $R
>...done
fi






More information about the Swlug mailing list