1752754 Members
4534 Online
108789 Solutions
New Discussion юеВ

Re: Cron Job Scheduel

 
SOLVED
Go to solution
Eric Jacklin
Regular Advisor

Cron Job Scheduel

Hi Team,

I would like to schedule a cronjob which will execute the job every friday & Saturday every 30 Min.

So can i use 30 * * * 5,6 ?
10 REPLIES 10
James R. Ferguson
Acclaimed Contributor
Solution

Re: Cron Job Scheduel

Hi:

Yes, this is correct.

Regards!

...JRF...
Dennis Handly
Acclaimed Contributor

Re: Cron Job Scheduel

No. That will do it every hour on the 30 minute mark. You need:
0,30 * * * 5,6
Dennis Handly
Acclaimed Contributor

Re: Cron Job Scheduel

I guess we should have also asked, every 30 minutes starting when? At 0015?
15,45 * * * 5,6
Eric Jacklin
Regular Advisor

Re: Cron Job Scheduel

I want to start the job from 1.00 AM on Friday untill saturday and frequency is every 30 min
Johnson Punniyalingam
Honored Contributor

Re: Cron Job Scheduel

Crontab syntax :-
A crontab file has five fields for specifying day , date and time followed by the command to be run at that interval.
cat
* * * * * command to be executed
- - - - -
| | | | |
| | | | +----- day of week (0 - 6) (Sunday=0)
| | | +------- month (1 - 12)
| | +--------- day of month (1 - 31)
| +----------- hour (0 - 23)
+------------- min (0 - 59)
Problems are common to all, but attitude makes the difference
James R. Ferguson
Acclaimed Contributor

Re: Cron Job Scheduel

Hi (again) Eric:

Duh! I'm sorry, Dennis is correct. You said *every* 30-minutes, not only at 30-minutes after the hour.

/* no points for my mistake nor this correction, please */

Regards!

...JRF...
jaivinder
Frequent Advisor

Re: Cron Job Scheduel

The correct syntax for the crontab will be

0,30 * * * 5,6
OldSchool
Honored Contributor

Re: Cron Job Scheduel

Stated it two different ways, and the still isn't clear.

If you want "...every friday & Saturday every 30 Min" then:

0,30 * * * 5,6


If you want "...1.00 AM on Friday until saturday frequency s every 30 min"...

If you mean 1:00am Friday until midnight Friday (i.e. until Saturday), then:

0,30 1-23 * * 5
(this will not run at 00:00 Saturday)

If you mean something else, you're going to have explain it again, and be very precise in your description.
Dennis Handly
Acclaimed Contributor

Re: Cron Job Scheduel

>OldSchool: If you mean 1:00am Friday until midnight Friday (i.e. until Saturday), then:
0,30 1-23 * * 5 # (this will not run at 00:00 Saturday)

Yes, 23*2 times. If you want to run one more time, you would need to add another line in crontab. Or you could expand the times in crontab and do the fine checking in your script.