Quote:
Originally Posted by anirudhbapu
Hello people,
I have a daily script which i execute it manually on daily basis..
1.On week days i need to run this script on 8 in the morning
2.ON week ends i need to run this at 8 in the night (only saturday and sundays).
3.Also In above two scenarios the 1st of every month should not be included and some special scipt runs on 1st of every month..
I could manage to find the solution for the 8 in the morning issue..
But failed for the week ends..
Below is the entries in the cron, the first one works fine but the second one(WEEKENDS) executes on week days as well as week ends....
##WEEKDAYS
00 08 2-31 * 1-5 /usr/.............
##WEEKENDS ()
00 20 2-31 * 0,6 /usr/........
PLease help, i just need to run only on saturday and sundays at 8 in the night except the 1st of every month........
Sorry for the delay in trying to help you.
Cron itself is a funny beast. You will find that shortcuts or methods that work on one machine's cron may or may not work on anothers. This is typically due to different versions of cron.
To see the manual page that explains the sections of the crontab, use this:
As for your issue on the weekends, have you tried specifying the days using the day names? Here is an example:
-
##WEEKENDS ()
-
00 20 2-31 * Sat,Sun /usr/........
-
If that does not work, then try something like "6,7", where 6 is Saturday and 7 is Sunday, instead of 0,6 as you have it.
Again, you just have to play with crontab to get everything right and working properly.
Regards,
Jeff