cancel
Showing results for
Did you mean:

SOLVED
Go to solution

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
Acclaimed Contributor
Solution

Re: Cron Job Scheduel

Hi:

Yes, this is correct.

Regards!

...JRF...
Acclaimed Contributor

Re: Cron Job Scheduel

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

Re: Cron Job Scheduel

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

Re: Cron Job Scheduel

I want to start the job from 1.00 AM on Friday untill saturday and frequency is every 30 min
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
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...

Re: Cron Job Scheduel

The correct syntax for the crontab will be

0,30 * * * 5,6
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.
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.
Honored Contributor

Re: Cron Job Scheduel

Hi,

This is the correct way to schedule job

0,30 * * * 5,6 /fullpath of u r command/script

Suraj