Lesson 16 — Scheduling & Automation Basics
cron + crontab -e + crontab -l + scheduled tasks
Linux systems are built to automate repeated work. This lesson teaches the basics of scheduling tasks with cron, editing user jobs with crontab -e, listing current jobs with crontab -l, and understanding how a simple scheduled command can save time and reduce human error.
Good automation follows a simple pattern: identify a repeatable task → schedule it clearly → verify it runs as expected.
Read basic cron timing, view scheduled jobs, create a simple recurring task, and understand why automation should be tested before trusting it.
Lesson Objectives
By the end of this lesson
- Understand what cron is used for
- Read the five timing fields in a cron entry
- List current scheduled jobs with
crontab -l - Edit scheduled jobs with
crontab -e - Write a simple recurring task safely
Why this matters
- Many admin tasks need to happen on a schedule
- Automation reduces repetitive manual work
- Bad automation can quietly fail if you do not verify it
1) What Cron Does
Purpose of cron
cron is used to run commands or scripts automatically at scheduled times.
Why it matters
Instead of depending on someone to remember the same task every day, Linux can run it automatically on schedule.
Typical use cases
- Backups
- Log cleanup
- Report generation
- Scripted health checks
Automation should reduce risk, not create hidden failure. Always verify that a scheduled task actually ran and did the right thing.
2) Understand a Cron Line
A standard cron entry has five timing fields followed by the command to run.
Basic structure
The five stars represent:
- Minute
- Hour
- Day of month
- Month
- Day of week
Example: every day at 2:30 AM
This means: run the script at 2:30 every day.
Example: every hour
This runs the command at minute 0 of every hour.
3) View and Edit Jobs with crontab
Users commonly manage their own scheduled jobs with crontab.
List scheduled jobs
This shows the current user’s scheduled cron entries.
Edit scheduled jobs
This opens the current user’s crontab for editing.
Simple example entry
This would run the script every day at 1:00 AM.
The script or command in a cron job should already work manually before you schedule it. Do not automate something untested.
4) Common Scheduling Examples
The easiest way to learn cron is to read simple examples.
Every day at midnight
Every Sunday at 3:15 AM
Every 15 minutes
5) Fast Troubleshooting Pattern
- Confirm the command or script works manually
- Read the cron timing carefully
- Add the job with
crontab -e - List jobs with
crontab -lto confirm it is saved - Verify the job actually ran and produced the expected result
Practical — Schedule a Simple Backup Script
This practical teaches a real support workflow instead of random command memorization.
Practical Task
- Choose a simple script or command that already works
- Decide when it should run
- Write a cron line for it
- Review the timing fields carefully
- Write one sentence describing what the automation does
Walkthrough
The goal is to choose a clear schedule, enter it correctly, save it, and then verify the job is present. In real life, you would also confirm the script actually runs and creates the expected result.
Example Ticket Note
Verified backup script worked manually, created scheduled cron entry for daily execution, confirmed job saved in user crontab, and documented expected run time for follow-up verification.
Write Your Observation
Use a simple note like a junior admin would write.
Mini Knowledge Check
Score 75% or higher to unlock the next lesson link. Your score is saved on this browser.
1) What is cron mainly used for?
2) Which command shows the current user’s scheduled cron jobs?
3) Which command is used to edit the current user’s cron jobs?
4) What is the strongest scheduling habit in this lesson?
Next Lesson
Tip: update the next lesson link when your page exists.