How to set cron job for bi-weekly (twice a week)

32,720

Solution 1

How about the following:

0 0 * * 1,4

This sets the day of week to Monday (1) and Thursday (4). You can choose any values 0–7 (both 0 and 7 are Sunday).

For a more readable crontab, you can also use names:

0 0 * * MON,THU

See also: How to instruct cron to execute a job every second week?

Solution 2

In reply to Elby question :

0 0 1,15 * *

This will set cronjob for (fortnight) 2 times in a Month i.e 1st day and 15th day of a month.

Solution 3

These answers are great, but I wanted to share a tool I found right after looking at this question and answers called crontab.guru. I'm not affiliated, I just thought it was a nice tool.

crontab.guru for 'At 00:00 on Monday and Thursday.'

Share:
32,720
Elby
Author by

Elby

Email application application developer, Currently working in Delhi

Updated on June 26, 2021

Comments

  • Elby
    Elby almost 3 years

    How do I set a cron job to run twice a week?

    I know how to set a cron job for every week:

    0 0 * * 0
    
  • Elby
    Elby over 11 years
    I want to set cron for 2 times in a Month. Set cron for once at a 2 week
  • cmbuckley
    cmbuckley over 11 years
    Biweekly is an ambiguous phrase; in the UK it tends to mean twice a week. For "every other week" we use fortnightly :-) See Petesh's comment above for a related question.