Monthly Report Generation at Noon on the 1st

cron expression Standard
$ 30 12 1 * *

Runs at 12:30 PM on the 1st day of every month.

30
Minute
12
Hour
1
Day of Month
*
Month
*
Day of Week

* In a Nutshell

The cron expression 30 12 1 * * runs Runs at 12:30 PM on the 1st day of every month.. This schedule is ideal for generating monthly reports or performing end-of-month cleanup tasks that need to be executed consistently at a predictable time after the month has begun. It ensures that monthly summaries or financial reconciliations are processed promptly on the first day of each new month.

* When to use this

Use 30 12 1 * * when a recurring task needs to run Runs at 12:30 PM on the 1st day of every month.. This schedule is commonly associated with end of month and monthly schedules and report generation workloads. It uses Standard (5-Field POSIX) syntax, supported by Unix cron daemons, cloud schedulers such as AWS EventBridge, and container orchestration platforms such as Kubernetes CronJob.

CronBase parses 30 12 1 * * using a dialect-aware rules engine that identifies the Standard (5-Field POSIX) format, validates field structure against the Standard (5-Field POSIX) specification, and produces the translation above. Next run times are calculated by forward-scanning from the current UTC clock. Learn how CronBase works.

Platform Implementations

Bash

Add the line '0 12 1 * * /path/to/your/script.sh' to your crontab using the 'crontab -e' command.

bash
0 12 1 * * /path/to/your/script.sh

Last verified:

Nodejs

Install the 'node-cron' package and use the provided code snippet in your Node.js application. Ensure the script is kept running (e.g., using PM2).

nodejs
const cron = require('node-cron');

cron.schedule('30 12 1 * *', () => {
  console.log('Running monthly task at 12:30 PM on the 1st');
  // Your task logic here
}, {
  scheduled: true,
  timezone: "Etc/UTC" 
});

Last verified:

Python

Ensure you have the 'python-crontab' library installed (pip install python-crontab). Run the Python script to add the job to your user's crontab.

python
from crontab import CronTab

cron = CronTab(user=True)
job = cron.new(command='/usr/bin/python /path/to/your/script.py', 
                 comment='Monthly Report Job')
job.minute.on(30)
job.hour.on(12)
job.day.on(1)
cron.write()

Last verified:

Golang

Use the 'github.com/robfig/cron/v3' library. Compile and run this Go program. It will maintain the schedule in memory.

golang
package main

import (
	"fmt"
	"github.com/robfig/cron/v3"
)

func main() {
	c := cron.New()
	c.AddFunc("0 12 1 * *", func() {
		fmt.Println("Running monthly task at 12:30 PM on the 1st")
		// Your task logic here
	})
	c.Start()

	// Keep the application running
	select {}
}

Last verified:

Java

Include the Quartz scheduler library. Replace YourTaskJob.class with your actual job implementation class. Ensure the Quartz scheduler is properly configured and started.

java
import org.quartz.CronScheduleBuilder;
import org.quartz.CronTrigger;
import org.quartz.JobBuilder;
import org.quartz.JobDetail;
import org.quartz.Scheduler;
import org.quartz.SchedulerException;
import org.quartz.TriggerBuilder;
import org.quartz.impl.StdSchedulerFactory;

public class MonthlyReportJob {

    public static void main(String[] args) throws SchedulerException {
        Scheduler scheduler = StdSchedulerFactory.getDefaultScheduler();

        JobDetail job = JobBuilder.newJob(YourTaskJob.class)
            .withIdentity("monthlyReportJob", "group1")
            .build();

        CronTrigger trigger = TriggerBuilder.newTrigger()
            .withIdentity("monthlyReportTrigger", "group1")
            .withSchedule(CronScheduleBuilder.cronSchedule("30 12 1 * *"))
            .build();

        scheduler.scheduleJob(job, trigger);
        scheduler.start();
    }
}

Last verified:

Kubernetes

Create a YAML file with the above content, replacing 'your-report-generator-image:latest' and 'your_script.sh' with your actual container image and script path. Apply it using 'kubectl apply -f your-cronjob.yaml'.

kubernetes
apiVersion: batch/v1
kind: CronJob
metadata:
  name: monthly-report-generator
spec:
  schedule: "30 12 1 * *"
  jobTemplate:
    spec:
      template:
        spec:
          containers:
          - name: report-generator
            image: your-report-generator-image:latest
            command: ["/bin/sh", "-c", "your_script.sh"]
          restartPolicy: OnFailure
  successfulJobsHistoryLimit: 1
  failedJobsHistoryLimit: 1

Last verified:

AWS EventBridge Equivalent

Standard cron expressions often need conversion for AWS EventBridge schedules.

EventBridge Rule
cron(30 12 1 * ? *)

Frequently Asked Questions

What does '30 12 1 * *' do?

This cron expression '30 12 1 * *' is configured to run a task at 12:30 PM on the 1st day of every month. The fields represent: minute (30), hour (12), day of month (1), month (* for every month), and day of week (* for every day of the week).

What timezone does this cron expression run in?

Cron expressions do not inherently have a timezone. They are executed based on the system's timezone where the cron daemon is running. To ensure predictable execution, especially across different environments or for business-critical tasks, it's best to run your cron jobs in a UTC-based environment or explicitly manage timezone conversions within your script.

How can I verify this cron job is running correctly?

To verify, check your system's cron logs (often located at /var/log/syslog, /var/log/cron, or accessible via `journalctl -u cron`) for entries related to your scheduled task. You can also add logging within the script being executed to confirm its start and end times.

What's a common variation of this schedule?

A common variation is scheduling for the *last* day of the month, which is often more complex due to varying month lengths. For example, '0 0 1 * *' would run at midnight on the 1st, a frequent choice for monthly tasks.

Are there any gotchas with monthly schedules?

Yes, the primary gotcha is handling months with fewer than 31 days. An expression targeting the 31st, for instance, would not run in months with only 30 days or February. This expression, targeting the 1st, avoids that specific issue but still relies on the server's correct date.

More schedules like this

Explore End of Month →

* Try any expression

Standard, Quartz, AWS EventBridge, Jenkins, named schedules (@daily, @hourly…)

* Keep Exploring

Related expressions you might need