Run on the 1st and 15th of Every Month | CronBase

cron expression Standard
$ 0 0 1,15 * *

At midnight on the first and fifteenth day of every month

The `0 0 1,15 * *` cron expression schedules a task to execute at exactly midnight (12:00 AM) on the first and fifteenth days of every month. This semi-monthly cadence is commonly used for processing payroll, generating bi-weekly financial statements, executing recurring billing cycles, and performing mid-month data archival tasks.

Minute
0
Hour
0
Day of Month
1,15
Month
*
Day of Week
*

Next 5 Runs

  • in 3d 13h
  • in 19d 13h
  • in 33d 13h
  • in 50d 13h
  • in 64d 13h

* Tools

Code & Implementations

nodejs
const cron = require('node-cron');
const { exec } = require('child_process');

// Schedule task to run on the 1st and 15th of the month at midnight UTC
cron.schedule('0 0 1,15 * *', () => {
  console.log('Starting semi-monthly processing job...');
  exec('/usr/local/bin/process-payroll.sh', (error, stdout, stderr) => {
    if (error) {
      console.error(`Execution error: ${error.message}`);
      return;
    }
    if (stderr) {
      console.warn(`Warnings: ${stderr}`);
    }
    console.log(`Output: ${stdout}`);
  });
}, {
  scheduled: true,
  timezone: \"UTC\"
});
Setup notes

Install node-cron package via npm, then run this script as a background daemon process using PM2 or systemd.

Partner BetterStack

Monitor this schedule in production

Get alerted the moment this cron job fails, is late, or doesn't run. BetterStack tracks execution, duration, and output — no infrastructure required.

Platform Equivalents

AWS EventBridge

Standard cron expressions often need conversion for AWS EventBridge schedules.

EventBridge Rule
cron(0 0 1,15 * ? *)

Systemd Timer

OnCalendar*-*-01,15 00:00:00

my-task.timer
[Unit]
Description=Timer for cron expression: 0 0 1,15 * *

[Timer]
OnCalendar=*-*-01,15 00:00:00
Persistent=true

[Install]
WantedBy=timers.target

Frequently Asked Questions

How can I handle timezone changes for a twice-monthly cron job?

To prevent Daylight Saving Time (DST) shifts from causing duplicate runs or missed executions, configure your cron runner or host server to operate entirely in UTC. This ensures execution occurs at the exact same physical interval regardless of seasonal clock changes.

What happens if the server is offline during the scheduled execution time?

Standard cron does not catch up on missed executions. If your server is offline at midnight on the 1st or 15th, the job will not run until the next scheduled date. For critical tasks, use a tool like anacron or implement a startup check that detects missed runs.

How can I test this cron schedule without waiting for the 1st or 15th?

You can simulate the execution by temporarily modifying the cron expression to run in the next few minutes (e.g., `*/5 * * * *`) or by manually triggering the underlying script or Kubernetes CronJob using `kubectl create job --from=cronjob/my-job`.

Can I schedule this job to run only on weekdays if the 1st or 15th falls on a weekend?

Standard cron cannot natively combine day-of-month and day-of-week with an 'AND' condition; it treats them as 'OR'. To achieve this, you must run the cron job on the 1st and 15th, and then use an inline shell script check like `[ $(date +%u) -le 5 ]` to exit early on weekends.

Why is running a resource-heavy database backup at midnight on these days risky?

Midnight is a highly contested slot where many default system maintenance tasks, log rotations, and automated backups trigger simultaneously. This causes resource contention. Shifting your schedule to an off-peak time like 02:15 AM reduces CPU and disk I/O bottlenecks.

* Explore

Related expressions you might need

Was this helpful?

Last verified: