Cron Has No Native Biweekly Option — But a Day-of-Month Trick Fills the Gap
Standard 5-field cron syntax has no built-in support for 'every 2 weeks,' leaving developers who need biweekly scheduling without an obvious solution. A common mistake is using expressions like '0 0 * * 1', which fires every Monday rather than every other Monday. A practical workaround combines day-of-month ranges with a weekday filter — for example, '0 0 1-7,15-21 * 1' reliably triggers once a fortnight on Mondays at midnight. However, windows ending near day 28 should be avoided as they can disappear in shorter months like February. For more complex biweekly logic, developers are advised to use a weekly cron trigger paired with a wrapper script, or switch to schedulers like APScheduler that support calendar-based intervals natively.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in