Home > Scripts > script to implement 3rd Saturday of the month.

script to implement 3rd Saturday of the month.

February 16, 2016

Today i got a requirement to run particular script on every 3rd Saturday of the month.  I tried to implement through crontab but somehow it did not worked out.  So i tried to write a script.

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

CURR_DAY_WEEK=`date +%a`
CURR_DAY=`date +%d`
if ( [ $CURR_DAY -gt 14 ] && [ $CURR_DAY -lt 23 ] && [ $CURR_DAY_WEEK -eq “Sat” ] )### Third Saturday fals between 15th to 22nd of every month.

#if ( [ $CURR_DAY -gt 7 ] && [ $CURR_DAY -lt 16 ] && [ $CURR_DAY_WEEK -eq “Sat” ] )### Second Saturday

then
{entire script will be placed here.}
fi

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

 

Note:-   This is simple script but i felt to record for future purpose.    You can change as per your requirement.

Advertisements
Categories: Scripts
%d bloggers like this: