Operating System - HP-UX
1847111 Members
6158 Online
110263 Solutions
New Discussion

what is the schedule for this crontab job

 
haeman
Frequent Advisor

what is the schedule for this crontab job

If I set this crontab job , is it mean it will run at 7:00am at 1st of mar , Jun , Sep , Dec ?


0 7 * 3,6,9,12 *
21 REPLIES 21
haeman
Frequent Advisor

Re: what is the schedule for this crontab job

if not , I would like to ask if I want it will be run at the date ( 1st of Mar , Jun , Sep , Dec ) , what can i do ? thx
YAQUB_1
Respected Contributor

Re: what is the schedule for this crontab job

Hi,

0 = 0 mints
7 = every day morning 7am
* = every day of the month
3 = March
6 = June
9 = September
12 = December
* = Week day not defined. So, above rule will be applicable.

Thanks--Yaqub
I am a Customer Advocate!!!
Aashique
Honored Contributor

Re: what is the schedule for this crontab job

Hi,

the format will be

0 7 1 3,6,9,12 * *


Thanks
haeman
Frequent Advisor

Re: what is the schedule for this crontab job

thx


0 7 1 3,6,9,12 * *


if as this , will it run at 1st and/or mar , jun Sep , Dec ?

i worry it will run at every 1st of month .
Aashique
Honored Contributor

Re: what is the schedule for this crontab job

Hi,
sorry for the last post.
correct syntex:
0 7 1 3,6,9,12 * script-name
haeman
Frequent Advisor

Re: what is the schedule for this crontab job

thx reply,

what is the relationship of 1 and 3,6,9,12 --> and / or ?


1 3,6,9,12
Aashique
Honored Contributor

Re: what is the schedule for this crontab job

Hi,
it will run only 1st of Mar(3), Jun(6),Sep(9),Dec(12).

Thanks & Regards

Aashique
Aashique
Honored Contributor

Re: what is the schedule for this crontab job

Hi,
1 means 1st of Month
3,6,9,12 means Mar,Jun,Sep,Dec

Thanks & Regards
haeman
Frequent Advisor

Re: what is the schedule for this crontab job

thx reply,

it is wong I think , I tested it , if use thiscron , it run at every 1st AND 1st of Mar , Jun , Sep , Dec .

could you confirm it ? and advise how to set it.
Yogeeraj_1
Honored Contributor

Re: what is the schedule for this crontab job

hi haeman,

I always include this template in my crontabs. Helps clear any confusions.


#*******************************************************************************
# min|hour |day |month|day |script
# | |of mo| |of wk|
#----|-----|-----|-----|-----|--------------------------------------------------
#*******************************************************************************



#*******************************************************************************
# END OF TABLE day0->Sunday day6->Saturday
#*******************************************************************************


hope this helps!

kind regards
yogeeraj

No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)
Aashique
Honored Contributor

Re: what is the schedule for this crontab job

Hi,
I confirm You that
the script will run at 7:00 am at 1st of Mar,1st of Jun,1st of Sep and 1st of Dec.

Thanks & Regards
Yogeeraj_1
Honored Contributor

Re: what is the schedule for this crontab job

hi again,

if you use the template, this should like as follows:

#**********************************************************************
# min|hour |day |month |day |script
# | |of mon| |of wk|
#----|-----|------|--------|-----|-------------------------------------
#**********************************************************************

00 07 1 3,6,9,12 * /home/yogeeraj/scripts/myscript.sh

#**********************************************************************
# END OF TABLE day0->Sunday day6->Saturday
#**********************************************************************


hope this helps!
kind regards
yogeeraj
No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)
Yogeeraj_1
Honored Contributor

Re: what is the schedule for this crontab job

sorry for the garbled output.
A more readable one is attached.
No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)
Shrikant Lavhate
Esteemed Contributor

Re: what is the schedule for this crontab job

Hi,

Aashique already answered you correctly. Job to run at 7:00am at 1st of mar , Jun , Sep , Dec the entry will be:

0 7 1 3,6,9,12 * script

>it is wrong I think , I tested it , if use this cron , it run at every 1st AND 1st of Mar , Jun , Sep , Dec .

Is it so? I don't think. It will run only 1st of mentioned 4 months only.

See manpage here:
http://www.docs.hp.com/en/B2355-90689/crontab.1.html

Also an example is described on this page which is exactly like your requirement:
http://www.adminschoice.com/docs/crontab.htm

-=ShRi=-
Will it remain a personal, if I broadcast it here!
haeman
Frequent Advisor

Re: what is the schedule for this crontab job

thx replies,

the relationship is AND ?

Shrikant Lavhate
Esteemed Contributor

Re: what is the schedule for this crontab job

relationship between 1 and 3,6,9,12 ?? yes
1st of all followed months.
Will it remain a personal, if I broadcast it here!
Aashique
Honored Contributor

Re: what is the schedule for this crontab job

Hi Haeman,
Ya here all relationship is AND. no OR here.

Thanks & Regards
Dennis Handly
Acclaimed Contributor

Re: what is the schedule for this crontab job

>the relationship is AND?

The relation is AND for all fields except the day of monthday and weekday:
minutes AND hour AND month AND (monthday OR weekday)
It is also AND for tztab(4).
Shrikant Lavhate
Esteemed Contributor

Re: what is the schedule for this crontab job

Haeman,

your profile shows that: I have assigned points to 1 of 69 responses to my questions.

:o

http://forums12.itrc.hp.com/service/forums/helptips.do?#34


Will it remain a personal, if I broadcast it here!
Aashique
Honored Contributor

Re: what is the schedule for this crontab job

Hi Haeman,

If you want to test it dont wait for 1st June.
test it today or tommorow's date.
tested it this way:

0 7 23 3,4,6,9,12 * date>/tmp/a.txt

it will run 23rd April morning 7:00 AM.
it will print the date command to the /tmp/a.txt file.

I think this is best idea to test it that your format is ok or not.I hope you can get the positive result.

If our suggestions were helpful, please read the following about assigning points:
http://forums.itrc.hp.com/service/forums/helptips.do?#33

Thanks & Regards

Aashique
khilari
Regular Advisor

Re: what is the schedule for this crontab job

My dear, it will run every day of the months that u specified not just on the first its a * and that means every day....