-
Hi guys,
I wish to schedule a job to run
once every 3 days . I want to enter something like this
0 0 1-3 * *
another once every week like
0 0 1-6 * *
Does this look right?
Thanks for your help
Life is what is happening today while you were planning tomorrow.
-
Originally posted by ndisang
0 0 1-3 * *
This will run your job on the 1st, 2nd, and 3rd of every month at midnight.
This will run your job on the 1st through the 6th of every month at midnight.
The fields, in order are:
minutes (0-59)
hour (0-23)
day of month (1-31)
month of year (1-12)
day of week (0-6, 0=sunday)
man crontab for details
Jeff Hunter
-
Cronjob once every three days, starting on Sunday
Code:
Runs exactly at midnight
0 0 * * 0,3,5
Runs anytime at midnight depending on the schedulability
* 0 * * 0,3,5
Cronjob once a week, executed on Friday Mid-night
Sam
Thanx
Sam
Life is a journey, not a destination!
-
Hi Jeff & Sam,
I have another question. One of our customer wants to run a job every month on first Sunday. How I can schedule crontjob for this.
Thanks,
Farrukh
-
You can't. You have to schedule the job to run either on sunday or the first 7 days of the month. At the very start of your script you have to check the other condition and exit if it's not true.
I know, it sucks and it doesn't work the way you think it should.
Jeff Hunter
-
Code:
0 0 1-7 * 0
This will execute the job on the first sunday only.
Sam
Thanx
Sam
Life is a journey, not a destination!
-
Thank you very much Jeff & Sam for you quick response. I feel more confident now to explain this to the customer.
Cheers!
Farrukh
-
Originally posted by sambavan
Code:
0 0 1-7 * 0
This will execute the job on the first sunday only.
Sam
Nope, not on Solaris anyway. This will execute on days 1-7 AND every sunday.
Jeff Hunter
-
Yep! you are correct. But there has to be some way to do it
Sam
Thanx
Sam
Life is a journey, not a destination!
-
From the man page ( http://docs.sun.com/ab2/coll.475.1/T...Enc=iso-8859-1 ):
minute (0-59),
hour (0-23),
day of the month (1-31),
month of the year (1-12),
day of the week (0-6 with 0=Sunday).
Each of these patterns may be either an asterisk (meaning all legal values) or a list of elements separated by commas. An element is either a number or two numbers separated by a minus sign (meaning an inclusive range). Note that the specification of days may be made by two fields (day of the month and day of the week). Both are adhered to if specified as a list of elements.
Jeff Hunter
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|