[SWLUG] Carmarthen meeting reminder - TONIGHT
Dafydd Walters
dafydd at walters-home.net
Tue Jan 15 21:04:01 UTC 2008
Oops. My last message contained weird formatting characters in the bash
script. The sanitised version:
#!/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
#################### End of Script
Here are the two cron entries:
0 4 * * * /home/dafydd/bin/swlug-reminder 'Mon' 15 21 'Carmarthen' 'Tuesday'
5 4 * * * /home/dafydd/bin/swlug-reminder 'Tue' 1 7 'Cardiff' 'Wednesday'
More information about the Swlug
mailing list