Willy,

This is probably more than you ever wanted to know.  I run special jobs on
certain days of the month.
I picked the first Friday, because the day will always be 7 or less.  The 3rd
Thursday was a little more
complicated.

This solution is not elegant, and some of the test for not trying this on a
Monday are still in the code.
I hope I commented them all out.  If you do get an elegant solution, I would
appreciate seeing that
solution.  There is always someone with a better idea.  That's what makes this
business interesting.
______________________________   cut here
_____________________________________________________
#! /bin/ksh
#
## 3rd_thr_even - Send email on the Monday preceding the
#                 3rd Thursday of every even months.
#
## Set up cron job to run this script every Monday.
#
# 1. If the current month is not even, exit.
# 2. If next Thursday is not the 3rd Thursday of this month, exit.
# 3. Mail out message.
#
MAIL_TO="[EMAIL PROTECTED]"
################################################################

#
## Test to see if this is an even month
#
integer MONTH=`/usr/bin/date +%m`
#
integer TEST=$MONTH
(( TEST = ( TEST / 2 ) * 2 ))
if [ $MONTH != $TEST ]
then
# 1. If the current month is not even, exit.
   echo `/usr/bin/date +%B`" is not an even month, wait until next month."
   exit
else
   echo `/usr/bin/date +%B`" is an even month, continue."
fi

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


#
## cron entry
#
#  30 9 * * 1 /path to/3rd_thr_even
#

###### The cron job will take care of this not being a Monday!
#      But, the next few lines will also work.  These lines
#      get around having to wait for a Monday to test the code.
#
## If this is not Monday, exit
#
if [ `/usr/bin/date +%a` != "Mon" ]

#  I tested on a Friday 4/21/2000
# if [ `/usr/bin/date +%a` != "Fri" ]
then
   echo "Today is NOT a Monday, wait until next Monday."
   exit
else
   integer This_Monday=`/usr/bin/date +%e`
   echo "This Monday: "$This_Monday
   echo "Today is a Monday, continue."

## For test, force today to be This_Monday
#
#  This_Monday=12
#  This_Monday=13
#  This_Monday=14
#  This_Monday=15
#  This_Monday=16
#  This_Monday=17
#  This_Monday=18
fi
#
###### The cron job will take care of this not being a Monday!


#
##  Find the 3rd Thursday of the month
#
## The 3rd Thursday of any month, must fall on:
#     15, 16, 17, 18, 19, 20, 21
## The preceding Monday, must fall on:
#     12, 13, 14, 15, 16, 17, 18
#
#
if [ $This_Monday -le 18 -a $This_Monday -ge 12 ]
then
    echo "This is the Monday before the 3rd Thursday, "`date`
    (( Thursday = This_Monday + 3 ))
    echo "This Thursday "$MONTH"/"$Thursday" is the day of the meeting!" > mail_
message
    cat mail_message
    mailx -s "Meeting on Thursday $MONTH/$Thursday" $MAIL_TO < mail_message
fi
________________________  cut here
___________________________________________________

Don
___________________________________________________
Don Rowland
Compaq Computer Corporation
4480 Lake Forest Drive, Suite 316
Cincinnati, OH 45242
(513) 577-7654
(FAX) 395-7982
Page (513) 530-3781
[EMAIL PROTECTED]

> ----------
> From:         Willy Peake[SMTP:[EMAIL PROTECTED]]
> Sent:         Friday, April 21, 2000 11:51 AM
> To:   [EMAIL PROTECTED]
> 
> Hello all.  I've been participating with the Utah State
> Races net for about 5 years now.  It involves the State
> Coordinator, 2 net controls, a cross band operator and 
> about 4/5 cross band operators.  There are always a 
> couple of people who forget about the net [the 3rd thur
> of even numbered months].  I run a slackware box full time
> and would like to implement some software to e-mail a
> list about a week before net date to remind everyone of
> the net.  I did some work for a company that had a ms
> exchange server and it would send reminder e-mails
> based on calendar entries.
> 
> Any suggestions on the best/easiest solution.  Thanks
> in advance.
> 
> Later, Willy * N7VVL
> [Loving the sunspot cycle now]
> 
> 

Reply via email to