Operating System - HP-UX
1753681 Members
5947 Online
108799 Solutions
New Discussion юеВ

Re: Configuring cron jobs.

 
SOLVED
Go to solution
Mohanasundaram_1
Honored Contributor

Configuring cron jobs.

Hi,

I want to schedule a job in cron to run on alternate Sundays. But I found this may not be possible, you can either give the dates or give the day of the week to run.

I tried giving as below

00 23 1-7, 24-30 * 0 //myscript

But according to the man pages it will be cumulative, that is, this script will run on 1-7th and 24-30th of each month and, in addition, will run on each sunday.

Does anybody know how to make the cron jobs run only on alternate Sundays ?

I am using HP-UX 11i.

Regards,
Mohan.
Attitude, Not aptitude, determines your altitude
7 REPLIES 7
Joseph Loo
Honored Contributor

Re: Configuring cron jobs.

hi,

do not think that is possible with crontab as it will not know which alternate sunday of the month you will like to run your job.

regards.
what you do not see does not mean you should not believe
Mobeen_1
Esteemed Contributor

Re: Configuring cron jobs.

Mohan,
The best way would be

Set in cron an entry to run every day at the correct start time. In the script check if day of week is Sun

regards
Mobeen



Mobeen_1
Esteemed Contributor

Re: Configuring cron jobs.

Mohan,
Here we go again :-), i missed out something

Submit an entry in cron to run every day. This entry will run at a specified time every day and will check if today is SUN. If it is throw in an additional check to see when was the last run day and if the last run day is 14 days run your job.

If it sounds, confusing tell me and i shall give some more details :-)

regards
Mobeen
Mobeen_1
Esteemed Contributor
Solution

Re: Configuring cron jobs.

Mohan,
I would also suggest that you review similar topic in these forums and i am sure that will guide you through and will have more options

http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=535974

regards
Mobeen

generic_1
Respected Contributor

Re: Configuring cron jobs.

I have had a similar need. You need to set your job to kick off ever Sunday and then check if it is the other Sunday.
Mohanasundaram_1
Honored Contributor

Re: Configuring cron jobs.

Thanks for the 3 of you for responding so quickly.

Joseph's reply indicated the inability of cron to do this job on its own.

Mobeen and Jeff gave the suggestions to solve this issue. The thread provided by Mobeen gives a good idea about solving this issue.

Thanks once again all of you for the speedy replies.

Cheers,
Mohan.
Attitude, Not aptitude, determines your altitude
Mohanasundaram_1
Honored Contributor

Re: Configuring cron jobs.

check the above updates for the solution.
Attitude, Not aptitude, determines your altitude