[CentOS] OT ? Shell script

Sun Dec 4 21:35:58 UTC 2005
Jonathan Wright <mailing-lists at djnauk.co.uk>

Robert wrote:
> Considering my nebulous request and your apparent lack of expertise in 
> applied clairvoyance, fine.
> The "3rd Monday" part is used in generating reminders to a each of a 
> group of OldFarts that gets together monthly to inventory aches, pains 
> and, yes, empty chairs. The "Sunday before" requirement will be used to 
> run a script (already working) to create a series of image files 
> containing critical stuff, to be burned (manually) to DVDs to go with me 
> to the meeting, to be given to a trusted person for safekeeping.
> 
> The following is what I have now, stripped down to the bare essentials 
> for clarity(?):

Looking at the way you've done it, you could to it like this:

if [$(date +%d) == $(date +%d -d $(date +%Y\/%m)/$((21-$(($(date +%w -d $(date +%Y\/%m)/21)-1)))))];
then
   // do 3rd Monday stuff...
elif [$(date +%d) == $(date +%d -d $(date +%Y\/%m)/$((21-$(($(date +%w -d $(date +%Y\/%m)/21))))))];
then
   // do Sunday before stuff
else
   // do nothing :)
fi

and therefore run the NSS.sh script directly.

-- 
  Jonathan Wright
   ~ mail at djnauk.co.uk
   ~ www.djnauk.co.uk
--
  2.6.14-gentoo-r2-djnauk-b1 AMD Athlon(tm) XP 2100+
  up 11:01, 5 users, load average: 1.17, 1.09, 1.07
--
  cat /dev/random (because u never know, u may see something u like)
--
  "No government has the right to tell its citizens when or  whom  to
  love. The only queer people are those who don't love anybody."

                                         ~ Rita Mae Brown, 28.08.1982