How to schedule a Unix shell script in crontab to run every 2nd Saturday(nth Day of the month)

advertisements

_____________________________________________________________________________________________________________________

The Eucharistic Miracles of the World
There is no direct way to schedule the script in crontab for nth day of every month. Which means suppose if you wanted to execute the shell script for every 2nd Saturday or every 3rd Monday, etc. (i.e: The execution occurrence will be one in a month; nth Sunday, Monday, Teusday, Wednesday, Thursday, Friday or Saturday) Crontab will not support this. You have to write your own code to execute this. A sample code is given below.
TODAY=`/bin/date +%d | cut -d"0" -f2`
DAY=`cal | awk {'print $7'} | xargs | /usr/bin/cut -d" " -f3`
#See if today matches the 2nd Tuesday of the month
if [ "$TODAY" -ne "$DAY" ] ; then
echo "Today is not Second Saturday"
else
echo "Today is 2nd Saturday. Please put your program code just below."
fi

_____________________________________________________________________________________________________________________

A visitor from Stockholm viewed 'ORA-00059: maximum number of DB_FILES exceeded - F' 33 secs ago
A visitor from Arusha viewed 'RMAN Restore Failed RMAN-06100: no channel to rest' 49 mins ago
A visitor from Apeldoorn viewed 'How to Find out / Check / Set Values for Hidden Un' 50 mins ago
A visitor from Moscow viewed 'Data Pump IMPDP REMAP_SCHEMA Parameter Syntax and ' 1 hr 2 mins ago
A visitor from Praia viewed 'How to Increase, Decrease or Resize FRA(Flash Reco' 1 hr 29 mins ago

0 comments:

Post a Comment

Labels

Oracle (629) Script (86) General (77) Unix (47) Blog (23) Technology (19) gadget (6) games (6) Business (3) OCI (3) SQL* Loader (3) Datapump (2)
 

acehints.com Copyright 2011-25 All Rights Reserved | Site Map | Contact | Disclaimer