Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a centos server and I want to run a job on it at 11PM every 2 days, how do I do that?

share|improve this question
up vote 8 down vote accepted

You can use the following cron arrangement. The fields denote (from left-to-right):
Minute, Hour, Day of Month, Month, Day of Week. The "*/2" in the Day of Month field means "every two days".

0 23 */2 * *

share|improve this answer
It should be added that this line is valid if the user is invoking 'crontab -e', which would edit user's crontab. If somebody wants to use system wide crontab, the user who should run the command must be specified before that command. Other than that, its perfect :) – Torian Nov 20 '10 at 19:26
My RHEL's 'man -s 5 crontab' says that '*' is 'first-last', which would expand '*/2' into '1,3,5,7...29,31'. I think that means that the script would run the 31st and the first on months with 31 days, which I don't think is the intended behavior. – Luke Nov 20 '10 at 19:59

In general, you need to use crontab to define the task and the run schedule.


crontab -e -u root

This will put you in VI editing root's crontab entry. Then as ewwhite says, enter:

0 23 */2 * *

and then [^ESC] ZZ to save the changes.

This is a good first attempt, but this is not quite every alternate day, as it will run on the 30th of the month and then next run on the 2nd of the month. If you really do need it to be every 2nd day, then run the script EVERY night.

0 23 * * *

and in the start of the script use

if -f /tmp/altday.txt
  rm /tmp/altday.txt
touch /tmp/altday.txt

This uses a text file to force the script to exit every alternate invocation.

share|improve this answer
Thanks guys great answers. – fred basset Nov 21 '10 at 17:07
0 23 1-31/2 * * /path/to/your/

Runs this script every 2 days i.e 1,3,5,7...31.

share|improve this answer
As far as I can see, this adds nothing to the accepted answer. Have I missed something? – MadHatter Aug 10 '15 at 11:47
This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post - you can always comment on your own posts, and once you have sufficient reputation you will be able to comment on any post. – Dave M Aug 10 '15 at 12:10

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.