1840915 Members
2652 Online
110174 Solutions
New Discussion

cron

 
Dan Am
Frequent Advisor

cron

is the a way to specify "first sunday of the month " directly in cron , with using suplementary shellscript ?
do what you can. don't if you can't.
4 REPLIES 4
Victor BERRIDGE
Honored Contributor

Re: cron

00 04 * * 0 /
in if [ $(date '+%d') -lt 8 ]
then

fi

Hope that helps
Regards
Victor
Victor BERRIDGE
Honored Contributor

Re: cron

In the previous post :
First line is in your cron of course
Sorry...
Victor
Andreas Voss
Honored Contributor

Re: cron

Hi,

at crontab this is not possible because specifying monthday and weekday are cumulative.
I would do:
crontab with :
* * 0 script
and in the script:
if [ $(date %d) -lt 8 ]
then
# do your stuff
fi

Regards

Re: cron

I don't think cron can schedule that. You'll need some shell script like Victor has shown. Or also you can use this: entry in cron (every sunday at 1am every month):
0 01 * * 0 /script_name

#Include in the script for checking if day #is greater than 7 days
[ $(date '+%d') -gt 7 ] && exit