1820396 Members
3276 Online
109623 Solutions
New Discussion юеВ

Crontab every 2 hour

 
la_cool
Occasional Advisor

Crontab every 2 hour

Hi ,
Could someone assist me with a crontab job,
I have a job which would have to run every 2 hours
6 REPLIES 6
RAC_1
Honored Contributor

Re: Crontab every 2 hour

0 0,2,4,6,8,10,12,14,16,18,20,22 * * * /your_command

Anil
There is no substitute to HARDWORK
Pete Randall
Outstanding Contributor

Re: Crontab every 2 hour

You'll need to make a crontab entry that runs the job every hour and then put logic in your script to only run every other time. Touching a file and test for it's presence or absence for example, could work.


Pete

Pete
Patrick Wallek
Honored Contributor

Re: Crontab every 2 hour

Say what, Pete? Making it a bit more difficult than it needs to be are we? :) Just kidding.

RAC's response will work quite well.
RAC_1
Honored Contributor

Re: Crontab every 2 hour

Disregard my earlier post.
You can user at for this. something like
at -f "script" +2 hour

Anil
There is no substitute to HARDWORK
Pete Randall
Outstanding Contributor

Re: Crontab every 2 hour

Brain cramp, I guess, Patrick! Obviously RAC has the perfect answer.


Pete (humbly)

Pete
Roberto Polli
Trusted Contributor

Re: Crontab every 2 hour

Hi.
you have to put in crontab something like this:

0 0,2,4,6,8,10,12,14,16,18,20,22 * * * command

Peace, R