Run Every Tuesday at 9 AM Schedule | CronBase
0 9 * * 2 Every Tuesday morning at nine AM
The `0 9 * * 2` cron expression schedules a task to execute automatically every Tuesday at exactly 9:00 AM. This weekly cadence is highly effective for kicking off business-hours processes, generating weekly status summaries, dispatching team reminders, or performing routine maintenance tasks that require weekly attention during the workweek.
- Minute
- 0
- Hour
- 9
- Day of Month
- *
- Month
- *
- Day of Week
- 2
Next 5 Runs
- in 3d 23h
- in 10d 23h
- in 17d 23h
- in 24d 23h
- in 31d 23h
* Tools
Code & Implementations
const cron = require('node-cron');
const { exec } = require('child_process');
console.log('Scheduler initialized. Waiting for Tuesday 9:00 AM execution...');
// Schedule task to run every Tuesday at 9:00 AM
cron.schedule('0 9 * * 2', async () => {
console.log(`[${new Date().toISOString()}] Initiating weekly report task...`);
try {
await runWeeklyTask();
console.log(`[${new Date().toISOString()}] Weekly task finished successfully.`);
} catch (error) {
console.error(`[${new Date().toISOString()}] Job execution failed:`, error);
// Integrate with Sentry, PagerDuty, or Slack here
}
}, {
scheduled: true,
timezone: "Etc/UTC"
});
function runWeeklyTask() {
return new Promise((resolve, reject) => {
exec('/usr/local/bin/generate-reports', (error, stdout, stderr) => {
if (error) {
return reject(error);
}
resolve(stdout);
});
});
} › Setup notes
Install 'node-cron' using npm. Run this script in a background process runner like PM2 to guarantee continuous execution.
#!/usr/bin/env bash
# Ensure only one instance of the script runs at a time
LOCKFILE="/var/tmp/tuesday_weekly_job.lock"
exec 9>>"$LOCKFILE"
if ! flock -n 9; then
echo "[$(date)] Job is already running. Exiting." >&2
exit 1
fi
echo "[$(date)] Starting weekly Tuesday maintenance task..."
# Your production task here
if /usr/local/bin/run-weekly-report >> /var/log/tuesday_job.log 2>&1; then
echo "[$(date)] Job completed successfully."
else
echo "[$(date)] Job failed! Sending alert..." >&2
# Add alerting logic here (e.g., curl to Slack webhook)
exit 1
fi › Setup notes
Add this script to your crontab by running 'crontab -e' and appending: 0 9 * * 2 /path/to/your/script.sh
import logging
import sys
from apscheduler.schedulers.blocking import BlockingScheduler
from apscheduler.triggers.cron import CronTrigger
logging.basicConfig(
level=logging.INFO,
format='%(asctime)s [%(levelname)s] %(message)s',
handlers=[logging.StreamHandler(sys.stdout)]
)
def execute_weekly_job():
logging.info("Starting weekly Tuesday maintenance job...")
try:
# Place production workload logic here
logging.info("Weekly job successfully completed.")
except Exception as e:
logging.error(f"Error occurred during job execution: {str(e)}", exc_info=True)
if __name__ == '__main__':
scheduler = BlockingScheduler()
# Trigger: Every Tuesday at 9:00 AM UTC
trigger = CronTrigger(day_of_week='tue', hour=9, minute=0, timezone='UTC')
scheduler.add_job(execute_weekly_job, trigger=trigger, id='weekly_tuesday_job')
logging.info("Scheduler started. Waiting for next Tuesday 9:00 AM UTC...")
try:
scheduler.start()
except (KeyboardInterrupt, SystemExit):
logging.info("Scheduler stopped.") › Setup notes
Install 'apscheduler' via pip, then run this script as a persistent service or daemon.
package main
import (
"log"
"os"
"os/signal"
"syscall"
"time"
"github.com/robfig/cron/v3"
)
func main() {
logger := log.New(os.Stdout, "[CRON-JOB] ", log.LstdFlags|log.Lshortfile)
// Use UTC timezone for predictable schedule behavior
loc, err := time.LoadLocation("UTC")
if err != nil {
logger.Fatalf("Failed to load UTC timezone: %v", err)
}
c := cron.New(cron.WithLocation(loc))
_, err = c.AddFunc("0 9 * * 2", func() {
logger.Println("Executing scheduled Tuesday 9 AM task...")
defer func() {
if r := recover(); r != nil {
logger.Printf("Recovered from panic in cron job: %v", r)
}
}()
// Execute business logic here
logger.Println("Scheduled Tuesday task completed successfully.")
})
if err != nil {
logger.Fatalf("Error scheduling job: %v", err)
}
c.Start()
logger.Println("Cron scheduler active. Running every Tuesday at 9 AM UTC.")
// Keep application running until interrupted
sigChan := make(chan os.Signal, 1)
signal.Notify(sigChan, syscall.SIGINT, syscall.SIGTERM)
<-sigChan
logger.Println("Shutting down scheduler...")
c.Stop()
} › Setup notes
Run 'go get github.com/robfig/cron/v3' to fetch the library, then build and run the executable.
package com.example.scheduler;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
@Component
public class WeeklyMaintenanceScheduler {
private static final Logger logger = LoggerFactory.getLogger(WeeklyMaintenanceScheduler.class);
// Standard Spring Cron: Second, Minute, Hour, Day-of-Month, Month, Day-of-Week
// "0 0 9 * * TUE" translates to 9:00 AM every Tuesday
@Scheduled(cron = "0 0 9 * * TUE", zone = "UTC")
public void runWeeklyTuesdayTask() {
logger.info("Initializing scheduled weekly Tuesday task...");
try {
performMaintenance();
logger.info("Weekly Tuesday task executed successfully.");
} catch (Exception e) {
logger.error("Exception caught during weekly task execution: ", e);
// Trigger pager alerts or system notifications here
}
}
private void performMaintenance() throws Exception {
// Your actual production database cleanup or reporting logic goes here
}
} › Setup notes
Ensure '@EnableScheduling' is declared on your main Spring Boot application class to activate the scheduled tasks.
apiVersion: batch/v1
kind: CronJob
metadata:
name: weekly-tuesday-maintenance
namespace: default
spec:
schedule: "0 9 * * 2"
concurrencyPolicy: Forbid
successfulJobsHistoryLimit: 3
failedJobsHistoryLimit: 5
startingDeadlineSeconds: 1800
jobTemplate:
spec:
template:
spec:
containers:
- name: worker
image: registry.example.com/maintenance-worker:latest
imagePullPolicy: IfNotPresent
resources:
limits:
cpu: "500m"
memory: "512Mi"
requests:
cpu: "250m"
memory: "256Mi"
restartPolicy: OnFailure › Setup notes
Apply this manifest using 'kubectl apply -f cronjob.yaml'. Ensure your cluster timezone handles the desired execution window correctly (most default to UTC).
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.
cron(0 9 ? * 2 *) Systemd Timer
OnCalendarTue *-*-* 09:00:00
[Unit]
Description=Timer for cron expression: 0 9 * * 2
[Timer]
OnCalendar=Tue *-*-* 09:00:00
Persistent=true
[Install]
WantedBy=timers.target
Frequently Asked Questions
How does Daylight Saving Time (DST) affect the Tuesday 9:00 AM execution?
If your server uses a local timezone that observes DST, the job will execute at 9:00 AM local time, but the interval between executions may vary by one hour during transition weeks. To maintain a strict 168-hour interval, configure your cron daemon or application scheduler to run in UTC.
What happens if the server is offline or asleep at Tuesday 9:00 AM?
Standard system cron will skip the execution entirely. For critical tasks, use a utility like `anacron` (which runs missed jobs when the system boots) or implement a custom state-check mechanism in your application to detect missed executions.
How can I run this job on both Tuesday and Thursday at 9:00 AM?
You can modify the fifth field of the cron expression to include a list of days. The updated expression `0 9 * * 2,4` will trigger the job on both Tuesdays (2) and Thursdays (4) at 9:00 AM.
How can I prevent multiple instances of this weekly job from running concurrently?
Use a locking wrapper like `flock` in Bash, or implement distributed locking using Redis (Redlock) or database locks inside your application code to ensure that slow-running executions do not overlap if a previous run hangs.
Is there a way to test or dry-run this specific schedule before deploying it to production?
Yes, you can use parsing libraries in your language of choice (such as `croniter` in Python or `cron-parser` in Node.js) to programmatically compute and print the next five execution dates to verify the schedule matches your expectations.
* Explore
Related expressions you might need
Last verified: