0 0 1 */4 * Cron Schedule Reference | CronBase

cron expression Standard
$ 0 0 1 */4 *

At midnight on the first day of every fourth month, specifically in January, May, and September.

This cron expression schedules a task to run at midnight on the first day of every fourth month. In standard cron environments, this translates to executing at 12:00 AM on January 1st, May 1st, and September 1st, providing a reliable triannual cadence for heavy maintenance and long-term data archiving.

Minute
0
Hour
0
Day of Month
1
Month
*/4
Day of Week
*

Next 5 Runs

  • in 111d 13h
  • in 231d 13h
  • in 354d 13h
  • in 476d 13h
  • in 597d 13h

* Tools

Code & Implementations

nodejs
const cron = require('node-cron');
const winston = require('winston'); // Production logger

const logger = winston.createLogger({
    level: 'info',
    transports: [new winston.transports.Console()]
});

// Expression: 0 0 1 */4 * (At midnight on day 1 of every 4th month)
const CRON_SCHEDULE = '0 0 1 */4 *';

try {
    const task = cron.schedule(CRON_SCHEDULE, async () => {
        const startTime = Date.now();
        logger.info('Starting triannual database archiving task...');
        try {
            // Perform heavy historical database archiving and index management
            await runArchivingPipeline();
            const duration = Date.now() - startTime;
            logger.info(`Archiving completed successfully in ${duration}ms`);
        } catch (error) {
            logger.error('Critical failure in triannual archiving job:', error);
            // Route to your incident response system (e.g., PagerDuty, Opsgenie)
            await alertOpsTeam(error);
        }
    }, {
        scheduled: true,
        timezone: "UTC" // Enforce UTC to avoid daylight saving shifts
    });
    task.start();
    logger.info('Triannual scheduler initialized successfully.');
} catch (initError) {
    logger.error('Failed to initialize triannual cron task:', initError);
    process.exit(1);
}

async function runArchivingPipeline() { /* Real business logic goes here */ }
async function alertOpsTeam(err) { /* Notification integration */ }
Setup notes

Install node-cron and winston via npm: npm install node-cron winston. Run this script as a daemon or background process.

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 */4 ? *)

Systemd Timer

OnCalendar*-00/4-01 00:00:00

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

[Timer]
OnCalendar=*-00/4-01 00:00:00
Persistent=true

[Install]
WantedBy=timers.target

Frequently Asked Questions

Which specific months will this cron expression execute in?

This schedule executes on the first day of January (month 1), May (month 5), and September (month 9). This is because the step value `*/4` starts at 1 and increments by 4.

How can I safely test a job that runs only once every four months?

Do not wait for the natural schedule. Test your code by triggering the execution script manually in a staging environment, or use tools to mock the system time to verify the scheduler behavior.

What timezone-related issues should I watch out for?

Standard cron runs on the host system's local time. If local time is used, transitions to and from Daylight Saving Time can shift the execution hour. Running servers in UTC mitigates this issue.

How should I set up monitoring for such an infrequent job?

Traditional threshold alerts are ineffective. Use an external monitoring service (a 'dead-man's switch') that expects a ping on the scheduled day, alerting you if that ping does not arrive within a specific window.

What happens if the host server is offline at midnight on the execution day?

Standard cron will miss the execution entirely and wait another four months. For critical jobs, use an orchestrator like Kubernetes with a `startingDeadlineSeconds` policy or systemd timers with persistent settings.

* Explore

Related expressions you might need

Was this helpful?

Last verified: