Kolam Ayer MakersLinux Foundations

cron and crontab

Use

EDITOR=micro crontab -e
crontab -l

What It Does

Cron runs commands on a time schedule. crontab edits or lists the schedule for your account.

Cron is useful for simple old-school jobs. In this course, prefer systemd user timers for site rebuilds because they have clearer service status, logs, and failure inspection.

Crontab Shape

* * * * * date >> /home/username/cron.log 2>&1

The five time fields are minute, hour, day of month, month, and day of week. Replace /home/username with the absolute path printed by printf '%s\n' "$HOME".

Safe Workflow

crontab -l > ~/crontab.backup 2>/dev/null || true
EDITOR=micro crontab -e
crontab -l
cat ~/cron.log

Remove the temporary line with EDITOR=micro crontab -e after proving it ran.

Why Timers Are Preferred Here

Watch Out

Docs Pointers