Back to academy
Free course
Beginner
5 lessons
110 min

Linux Cron

Learn standard Unix/Linux cron from first principles: crontab syntax, environment issues, logging, debugging, and safe production jobs.


What you will learn

  • Read and write standard five-field cron expressions.
  • Install and inspect user crontabs safely.
  • Debug PATH, environment, permissions, and logging problems.
  • Design cron jobs that are observable and safe to retry.

Course lessons

1. Cron and crontab fundamentals
18 min

Understand what cron does and how crontab entries are evaluated.

Cron daemon
User crontabs
System crontabs
Five-field syntax

Exercise: Create expressions for every 5 minutes, every hour, and every day at midnight.

2. Operators and field behavior
22 min

Use stars, steps, lists, ranges, weekday aliases, and month aliases confidently.

*
/
,
-
MON-FRI
JAN

Exercise: Build a weekday 09:00 schedule and validate it in Cron Explainer.

3. Cron environment and shell scripts
24 min

Avoid the classic 'works manually but not in cron' failure mode.

PATH
SHELL
Working directory
Absolute paths
Environment variables

Exercise: Write a cron-safe shell command that redirects stdout and stderr to a log file.

4. Production logging and monitoring
20 min

Make scheduled jobs debuggable after they fail at 03:00.

Log redirection
Exit codes
Heartbeats
Alerts
Run history

Exercise: Add a heartbeat call and failure log to a backup cron job.

5. Safe retries and overlap prevention
26 min

Protect jobs that can run longer than their schedule interval.

Lock files
Idempotency
Duplicate runs
Long-running jobs

Exercise: Design a locking strategy for a job scheduled every 15 minutes.

More free courses

Academy
Intermediate
Kubernetes Scheduling

Learn Kubernetes CronJobs, schedule syntax, concurrencyPolicy, restart behavior, missed jobs, timezones, and production-safe manifests.

Open
Academy
Intermediate
AWS EventBridge

Master AWS EventBridge cron and rate schedules, UTC behavior, question-mark syntax, targets, retries, and production patterns.

Open
Academy
Intermediate
Quartz Scheduler

Learn Quartz cron syntax for Java schedulers, including seconds, optional years, ?, L, W, #, and business-calendar patterns.

Open
Academy
Advanced
DevOps Automation

Learn how to design production-safe scheduled automation for backups, cleanup, monitoring, ETL, log rotation, and maintenance.

Open