Run Morning Jobs Every Weekday at 6 AM | CronBase
0 6 * * 1-5 Every morning from Monday through Friday at six o'clock.
This cron expression schedules a task to run automatically at 6:00 AM every weekday, from Monday through Friday. It is commonly used in enterprise environments to trigger morning database warmups, generate daily business intelligence reports, and kick off early-morning system checks before the standard business day begins.
- Minute
- 0
- Hour
- 6
- Day of Month
- *
- Month
- *
- Day of Week
- 1-5
Next 5 Runs
- in 1d 9h
- in 2d 9h
- in 3d 9h
- in 4d 9h
- in 5d 9h
* Tools
Code & Implementations
#!/bin/bash
# Morning weekday execution script
set -euo pipefail
LOG_FILE="/var/log/morning_sync.log"
echo "$(date -u) - Starting morning weekday job" >> "$LOG_FILE"
# Execute core system logic
if /usr/local/bin/run-warmups.sh >> "$LOG_FILE" 2>&1; then
echo "$(date -u) - Job completed successfully" >> "$LOG_FILE"
else
echo "$(date -u) - Job failed" >> "$LOG_FILE"
exit 1
fi › Setup notes
Save this script to /usr/local/bin/morning-job.sh, make it executable with 'chmod +x', and register it in your crontab using '0 6 * * 1-5 /usr/local/bin/morning-job.sh'.
const cron = require('node-cron');
const { exec } = require('child_process');
// Schedule task to run at 6:00 AM, Monday through Friday
cron.schedule('0 6 * * 1-5', () => {
console.log(`[${new Date().toISOString()}] Starting morning weekday process...`);
exec('/usr/local/bin/process-data.sh', (error, stdout, stderr) => {
if (error) {
console.error(`[ERROR] Task failed: ${error.message}`);
return;
}
if (stderr) {
console.warn(`[WARN] Task stderr: ${stderr}`);
}
console.log(`[SUCCESS] Task output: ${stdout}`);
});
}, {
scheduled: true,
timezone: "UTC"
}); › Setup notes
Install 'node-cron' via npm. Ensure your Node process runs continuously using a process manager like PM2 to guarantee the schedule is maintained.
import logging
from apscheduler.schedulers.blocking import BlockingScheduler
from apscheduler.triggers.cron import CronTrigger
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
def morning_job():
logger.info("Executing scheduled morning weekday task...")
try:
# Insert your core application/cleanup logic here
pass
except Exception as e:
logger.error(f"Task failed: {e}", exc_info=True)
scheduler = BlockingScheduler()
# Standard 0 6 * * 1-5 maps to minute=0, hour=6, day_of_week='mon-fri'
trigger = CronTrigger(minute=0, hour=6, day_of_week='mon-fri', timezone='UTC')
scheduler.add_job(morning_job, trigger)
try:
logger.info("Starting scheduler...")
scheduler.start()
except (KeyboardInterrupt, SystemExit):
logger.info("Scheduler stopped.") › Setup notes
Install APScheduler using 'pip install apscheduler' and run this script within a persistent container or background process.
package main
import (
"log"
"os"
"os/signal"
"syscall"
"github.com/robfig/cron/v3"
)
func main() {
// Use the standard 5-field cron parser
c := cron.New(cron.WithParser(cron.NewParser(
cron.Minute | cron.Hour | cron.Dom | cron.Month | cron.Dow | cron.Descriptor,
)))
_, err := c.AddFunc("0 6 * * 1-5", func() {
log.Println("Starting weekday morning task execution...")
// Execute application tasks here
})
if err != nil {
log.Fatalf("Failed to schedule job: %v", err)
}
c.Start()
log.Println("Cron scheduler initialized successfully")
// Prevent main routine from exiting
sig := make(chan os.Signal, 1)
signal.Notify(sig, syscall.SIGINT, syscall.SIGTERM)
<-sig
c.Stop()
} › Setup notes
Initialize a Go module, import robfig/cron/v3, build the binary, and deploy it as a systemd service.
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 MorningTaskScheduler {
private static final Logger logger = LoggerFactory.getLogger(MorningTaskScheduler.class);
// Spring cron: second, minute, hour, day of month, month, day(s) of week
@Scheduled(cron = "0 0 6 * * MON-FRI", zone = "UTC")
public void executeMorningJob() {
logger.info("Starting weekday morning scheduled task...");
try {
// Core business logic goes here
logger.info("Scheduled task completed successfully.");
} catch (Exception e) {
logger.error("Exception caught during scheduled task execution", e);
}
}
} › Setup notes
Ensure '@EnableScheduling' is declared in your main Spring Boot application class. This component will automatically be scanned and scheduled.
apiVersion: batch/v1
kind: CronJob
metadata:
name: weekday-morning-job
namespace: default
spec:
schedule: "0 6 * * 1-5"
concurrencyPolicy: Forbid
successfulJobsHistoryLimit: 3
failedJobsHistoryLimit: 5
jobTemplate:
spec:
template:
spec:
containers:
- name: worker
image: busybox:1.36
command:
- /bin/sh
- -c
- "echo 'Waking up systems...'; date; sleep 30"
restartPolicy: OnFailure › Setup notes
Apply this manifest using 'kubectl apply -f cronjob.yaml'. Set concurrencyPolicy to 'Forbid' to prevent overlapping runs if a task hangs.
Last verified:
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 6 ? * 1-5 *) Systemd Timer
OnCalendarMon..Fri *-*-* 06:00:00
[Unit]
Description=Timer for cron expression: 0 6 * * 1-5
[Timer]
OnCalendar=Mon..Fri *-*-* 06:00:00
Persistent=true
[Install]
WantedBy=timers.target
Last verified:
Frequently Asked Questions
How does daylight saving time affect this 6 AM schedule?
If your system timezone is set to a local zone that observes DST, the execution time will shift relative to UTC. In the spring transition, the job runs normally, but during autumn transitions, it might execute twice if the system does not handle duplicate hours. Running servers in UTC avoids this.
Why is the Monday run of this job taking significantly longer?
The Monday morning run is processing data accumulated over the entire weekend (Saturday and Sunday). Ensure your database queries, memory limits, and API integrations are optimized to handle three times the daily volume compared to mid-week runs.
Can I run this job on holidays that fall on weekdays?
Standard cron does not have built-in holiday awareness. The job will execute on weekday holidays (like Thanksgiving or Christmas) unless you implement custom logic inside your application code or wrapper script to check a holiday calendar and exit early.
How can I test this cron schedule without waiting until 6 AM?
You can temporarily modify the schedule in your development environment to run every minute (using `* * * * *`), or use a tool like `croniter` in Python or `go-cron` to simulate execution times. Alternatively, trigger the underlying script manually to verify its functionality.
What is the best way to monitor if this job failed to run?
Implement an external monitoring service using a 'dead man's snitch' or heartbeat pattern. Have your script send an HTTP request to the monitoring service at the end of its run. If the service does not receive the ping by 6:15 AM, it triggers an alert.
* Explore
Related expressions you might need
Last verified: