DevToolBoxKOSTENLOS
Blog

Crontab Cheat Sheet 2025: 50+ Cron-Ausdruck-Beispiele für die Praxis

12 Min. Lesezeitvon DevToolBox

Ob Backups, Deployments oder Bereinigungsskripte — cron ist das Rückgrat der Aufgabenplanung auf Unix/Linux. Dieses Cheat Sheet bietet 50+ kopierbare Cron-Ausdruck-Beispiele nach Häufigkeit sortiert.

1. Cron-Ausdruck-Syntax

Ein Standard-Cron-Ausdruck besteht aus 5 Feldern:

┌───────────── Minute (0–59)
│ ┌─────────── Stunde (0–23)
│ │ ┌───────── Tag des Monats (1–31)
│ │ │ ┌─────── Monat (1–12)
│ │ │ │ ┌───── Wochentag (0–7)
│ │ │ │ │
* * * * *  command_to_execute

Der Befehl folgt den fünf Feldern. Nutzen Sie unseren Cron-Generator.

Cron Generator Tool →

2. Sonderzeichen

Cron verwendet vier Sonderzeichen:

ZeichenBedeutungBeispielBeschreibung
*Entspricht jedem möglichen Wert* * * * *Every minute
,Gibt eine Liste an0 9 * * 1,3,5Mon, Wed, Fri at 9 AM
-Definiert einen Bereich0 9 * * 1-5Mon through Fri at 9 AM
/Definiert ein Schrittintervall*/10 * * * *Every 10 minutes

3. 50+ Cron-Ausdruck-Beispiele

Die folgenden Tabellen decken die häufigsten Cron-Zeitpläne ab.

Alle X Minuten

AusdruckBeschreibungNächste Ausführung
* * * * *Every minute10:00, 10:01, 10:02 ...
*/1 * * * *Every minute (explicit)10:00, 10:01, 10:02 ...
*/2 * * * *Every 2 minutes10:00, 10:02, 10:04 ...
*/5 * * * *Every 5 minutes10:00, 10:05, 10:10 ...
*/10 * * * *Every 10 minutes10:00, 10:10, 10:20 ...
*/15 * * * *Every 15 minutes10:00, 10:15, 10:30, 10:45
*/20 * * * *Every 20 minutes10:00, 10:20, 10:40 ...
*/30 * * * *Every 30 minutes10:00, 10:30, 11:00 ...
0,15,30,45 * * * *At 0, 15, 30, 45 minutes past each hour10:00, 10:15, 10:30, 10:45

Stündliche Zeitpläne

AusdruckBeschreibungNächste Ausführung
0 * * * *Every hour (at minute 0)10:00, 11:00, 12:00 ...
30 * * * *Every hour at minute 3010:30, 11:30, 12:30 ...
15 * * * *Every hour at minute 1510:15, 11:15, 12:15 ...
0 */2 * * *Every 2 hours00:00, 02:00, 04:00 ...
0 */3 * * *Every 3 hours00:00, 03:00, 06:00 ...
0 */4 * * *Every 4 hours00:00, 04:00, 08:00 ...
0 */6 * * *Every 6 hours00:00, 06:00, 12:00, 18:00
0 */8 * * *Every 8 hours00:00, 08:00, 16:00
0 */12 * * *Every 12 hours00:00, 12:00

Tägliche Zeitpläne

AusdruckBeschreibungNächste Ausführung
0 0 * * *Daily at midnight (00:00)Tomorrow 00:00
0 1 * * *Daily at 1:00 AMTomorrow 01:00
0 6 * * *Daily at 6:00 AMTomorrow 06:00
30 7 * * *Daily at 7:30 AMTomorrow 07:30
0 9 * * *Daily at 9:00 AMTomorrow 09:00
30 8 * * *Daily at 8:30 AMTomorrow 08:30
0 12 * * *Daily at noon (12:00)Tomorrow 12:00
0 15 * * *Daily at 3:00 PMTomorrow 15:00
0 18 * * *Daily at 6:00 PMTomorrow 18:00
0 23 * * *Daily at 11:00 PMTomorrow 23:00
0 8-17 * * *Every hour from 8 AM to 5 PM08:00, 09:00 ... 17:00
0 9,12,18 * * *Three times a day (9 AM, noon, 6 PM)09:00, 12:00, 18:00

Wöchentliche Zeitpläne

AusdruckBeschreibungNächste Ausführung
0 9 * * 1Every Monday at 9:00 AMNext Monday 09:00
0 9 * * 1-5Weekdays (Mon-Fri) at 9:00 AMNext weekday 09:00
0 0 * * 0Every Sunday at midnightNext Sunday 00:00
0 0 * * 6,0Saturday & Sunday at midnightNext Sat/Sun 00:00
0 17 * * 5Every Friday at 5:00 PMNext Friday 17:00
0 9 * * 1,3,5Mon, Wed, Fri at 9:00 AMNext Mon/Wed/Fri 09:00
0 8-17 * * 1-5Hourly 8AM–5PM, weekdays onlyNext weekday 08:00
30 6 * * 1-5Weekdays at 6:30 AMNext weekday 06:30

Monatliche Zeitpläne

AusdruckBeschreibungNächste Ausführung
0 0 1 * *1st of every month at midnightNext month, 1st 00:00
0 0 15 * *15th of every month at midnightNext 15th 00:00
0 9 1 * *1st of every month at 9:00 AMNext month, 1st 09:00
0 0 1,15 * *1st and 15th at midnightNext 1st or 15th 00:00
0 0 * * 5LLast Friday of the month (non-std)Last Fri 00:00
0 9 * * 1#1First Monday of the month (non-std)First Mon 09:00
0 0 28 * *28th of every month at midnightNext 28th 00:00

Jährliche / Quartalszeitpläne

AusdruckBeschreibungNächste Ausführung
0 0 1 1 *January 1st at midnightJan 1 00:00
0 0 1 1,4,7,10 *Quarterly: Jan, Apr, Jul, Oct 1stNext quarter 00:00
0 0 1 1,7 *Bi-annually: Jan 1 & Jul 1Jan 1 or Jul 1 00:00
0 0 25 12 *December 25th at midnightDec 25 00:00
0 0 1 */3 *Every 3 months on the 1stNext 1st in 3 months
0 0 1 */6 *Every 6 months on the 1stNext 1st in 6 months

Business & DevOps

AusdruckBeschreibungNächste Ausführung
0 2 * * *Database backup at 2:00 AM dailyTomorrow 02:00
0 3 * * 0Log rotation every Sunday at 3 AMNext Sunday 03:00
0 4 1 * *Monthly DB cleanup on 1st at 4 AMNext month, 1st 04:00
0 1 * * *SSL cert check daily at 1 AMTomorrow 01:00
*/5 * * * *Health check every 5 minutes10:00, 10:05, 10:10 ...
0 5 * * 1-5Deploy window: weekdays at 5 AMNext weekday 05:00
0 0 * * *Rotate logs daily at midnightTomorrow 00:00
0 */4 * * *Send report digest every 4 hours00:00, 04:00, 08:00 ...
0 22 * * 5Friday night maintenance at 10 PMNext Friday 22:00
30 2 * * *Temp file cleanup at 2:30 AM dailyTomorrow 02:30
Cron Expression Parser Tool →

4. Crontab-Befehle

Der crontab-Befehl verwaltet Cron-Dateien:

BefehlFunktion
crontab -eEdit your crontab file (opens in default editor)
crontab -lList all cron jobs for the current user
crontab -rRemove all cron jobs for the current user (use with caution!)
crontab -u alice -lList cron jobs for a specific user (requires root)
crontab -u alice -eEdit crontab for a specific user (requires root)
crontab filenameInstall a crontab from a file (overwrites existing)
# Edit crontab
crontab -e

# List all cron jobs
crontab -l

# Backup current crontab to a file
crontab -l > my-crontab-backup.txt

# Install crontab from a file
crontab my-crontab-backup.txt

# Remove all cron jobs (careful!)
crontab -r
Crontab Generator Tool →

5. Plattformspezifische Syntax

Die Cron-Syntax variiert je nach Plattform:

Linux crontab

5 Felder. Das Standard-Format.

# Standard 5-field crontab
*/5 * * * * /usr/local/bin/backup.sh >> /var/log/backup.log 2>&1
GitHub Actions

5 Felder in schedule.cron. Immer UTC.

# .github/workflows/scheduled.yml
on:
  schedule:
    - cron: '0 9 * * 1-5'  # Weekdays 9AM UTC
AWS CloudWatch

6 Felder. Verwendet ?.

# AWS EventBridge (6 fields, note the ?)
cron(0 9 ? * MON-FRI *)  # Weekdays 9AM UTC
Kubernetes CronJob

5 Standard-Felder. Timezone ab K8s 1.27+.

# Kubernetes CronJob spec
apiVersion: batch/v1
kind: CronJob
metadata:
  name: daily-backup
spec:
  schedule: "0 2 * * *"
  timeZone: "America/New_York"  # K8s 1.27+
Vercel Cron

5 Felder in vercel.json. UTC.

// vercel.json
{
  "crons": [{
    "path": "/api/cron/daily-report",
    "schedule": "0 9 * * *"
  }]
}

6. Häufige Fallstricke

Die häufigsten Fehler bei Cron:

1
Zeitzone

Cron nutzt die Systemzeitzone. CI/CD-Plattformen nutzen UTC.

2
Überlappende Ausführungen

Nutzen Sie flock oder eine Lock-Datei.

3
Sommerzeit

Nutzen Sie UTC um Probleme zu vermeiden.

4
Tag UND Wochentag

Wenn beide gesetzt sind, läuft der Job bei einem von beiden.

5
Keine Sekunden

Mindestauflösung: 1 Minute. Für Sub-Minute nutzen Sie sleep.

6
Umgebungsvariablen

Cron-Jobs laufen mit minimaler Umgebung. Verwenden Sie vollständige Pfade.

# Gotcha: overlapping runs - use flock to prevent
*/5 * * * * /usr/bin/flock -n /tmp/myjob.lock /path/to/script.sh

# Gotcha: environment - always use full paths
0 2 * * * /usr/bin/python3 /home/user/scripts/backup.py >> /var/log/backup.log 2>&1

# Gotcha: 30-second workaround (two entries)
* * * * * /path/to/script.sh
* * * * * sleep 30 && /path/to/script.sh

# Gotcha: PATH not set - define it at the top of your crontab
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

# Gotcha: percent signs (%) must be escaped in crontab
# Wrong:
0 0 * * * echo "Today is $(date +%Y-%m-%d)"
# Correct:
0 0 * * * echo "Today is $(date +\%Y-\%m-\%d)"

Sample Crontab File

Here is a complete, real-world crontab file combining several patterns discussed above:

# =============================================
# Crontab for: webserver (production)
# Last updated: 2025-01-15
# =============================================

# Environment
SHELL=/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
MAILTO="ops-team@example.com"

# --- BACKUPS ---
# Full database backup at 2:00 AM daily
0 2 * * * /usr/bin/flock -n /tmp/db-backup.lock /opt/scripts/db-backup.sh >> /var/log/db-backup.log 2>&1

# Incremental file backup every 6 hours
0 */6 * * * /opt/scripts/file-backup.sh >> /var/log/file-backup.log 2>&1

# --- MAINTENANCE ---
# Clear temp files older than 7 days, daily at 3 AM
0 3 * * * /usr/bin/find /tmp -type f -mtime +7 -delete

# Rotate application logs every Sunday at 4 AM
0 4 * * 0 /opt/scripts/rotate-logs.sh >> /var/log/log-rotation.log 2>&1

# --- MONITORING ---
# Health check every 5 minutes
*/5 * * * * /opt/scripts/healthcheck.sh > /dev/null 2>&1

# SSL certificate expiry check daily at 6 AM
0 6 * * * /opt/scripts/check-ssl.sh

# Disk space alert if usage > 90%, every hour
0 * * * * /opt/scripts/disk-alert.sh

# --- REPORTS ---
# Send daily summary at 8 AM on weekdays
0 8 * * 1-5 /opt/scripts/daily-report.sh

# Monthly analytics report on the 1st at 9 AM
0 9 1 * * /opt/scripts/monthly-report.sh

7. Testen und Debuggen

Vor dem Produktiv-Deployment:

1
Cron-Parser

Nutzen Sie unseren Cron-Ausdruck-Parser.

2
Cron-Logs

Prüfen Sie /var/log/syslog oder /var/log/cron.

3
Ausgabe umleiten

Erfassen Sie stdout/stderr in einer Logdatei.

4
Mit kurzen Intervallen testen

Testen Sie zuerst mit * * * * *.

5
Mail-Konfiguration

Setzen Sie MAILTO="" zum Deaktivieren.

# Redirect all output to a log file
0 2 * * * /path/to/backup.sh >> /var/log/cron-backup.log 2>&1

# Disable cron mail for this job
0 2 * * * /path/to/backup.sh > /dev/null 2>&1

# Set MAILTO at the top of crontab
MAILTO=""
# Or send to a real address
MAILTO="admin@example.com"

# Check cron logs on Debian/Ubuntu
grep CRON /var/log/syslog | tail -20

# Check cron logs on CentOS/RHEL
grep CRON /var/log/cron | tail -20

# On systems using journald (systemd)
journalctl -u cron --since "1 hour ago"

# Quick test: add a job that writes to a file
# Then check if the file gets updated
* * * * * echo "cron works: $(date)" >> /tmp/cron-test.log

# Verify your crontab was saved correctly
crontab -l | grep -v '^#'

# Check if cron daemon is running
systemctl status cron    # Debian/Ubuntu
systemctl status crond   # CentOS/RHEL

Common Cron Debugging Checklist

CheckHow to Verify
Cron daemon running?systemctl status cron (or crond)
Crontab saved?crontab -l and look for your entry
Script executable?chmod +x /path/to/script.sh
Full paths used?Use which python3 to find full path
Output captured?Add >> /tmp/debug.log 2>&1
Permissions correct?Script owner = crontab owner
No syntax errors?bash -n /path/to/script.sh
Timezone correct?timedatectl or date to check

Erstellen und testen Sie Ihre Cron-Ausdrücke:

8. Häufig gestellte Fragen

Was ist das Format eines Cron-Ausdrucks?

Ein Standard-Cron-Ausdruck hat 5 Felder: Minute (0-59), Stunde (0-23), Tag (1-31), Monat (1-12) und Wochentag (0-7).

Was bedeutet */5 in Cron?

*/5 bedeutet "alle 5 Einheiten". Im Minutenfeld läuft */5 * * * * alle 5 Minuten.

Wie führe ich einen Cron-Job alle 30 Sekunden aus?

Standard-Cron unterstützt keine Sub-Minuten-Intervalle. Erstellen Sie zwei Einträge mit sleep 30.

Was ist der Unterschied zwischen cron und crontab?

Cron ist der Daemon. Crontab ist die Datei mit den geplanten Jobs.

Kann ich cron unter Windows verwenden?

Natives Windows hat kein cron. Die Alternative ist der Aufgabenplaner. Mit WSL können Sie cron normal nutzen.

𝕏 Twitterin LinkedIn
War das hilfreich?

Bleiben Sie informiert

Wöchentliche Dev-Tipps und neue Tools.

Kein Spam. Jederzeit abbestellbar.

Verwandte Tools ausprobieren

Cron Expression GeneratorCron Expression Parser⏲️Crontab Generator🔍Cron Expression Parser

Verwandte Artikel

Cron-Ausdruck Generator & Parser: Syntax, Beispiele & Code-Anleitung

Kostenloser Cron-Ausdruck Generator und Parser. Cron-Syntax lernen und Jobs mit Node.js, Python und Bash planen.

Docker Compose YAML-Validierung: 10 häufige Syntaxfehler und ihre Behebung

Verschwenden Sie keine Zeit mit Docker Compose YAML-Fehlern. Lernen Sie die 10 häufigsten Syntaxfehler zu erkennen und zu beheben.