Lesson 16 — Scheduling & Automation Basics

CompTIA Cyber Path • Linux / Admin Basics • Lesson 16

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.

Core idea:

Good automation follows a simple pattern: identify a repeatable taskschedule it clearlyverify it runs as expected.

What you’ll be able to do:

Read basic cron timing, view scheduled jobs, create a simple recurring task, and understand why automation should be tested before trusting it.

Linux basics cron + crontab automation mindset local progress saved
Progress: 0%
Identify Repeated Taskbackup, cleanup, report
Define Scheduleminute hour day month weekday
Create Cron Jobcrontab -e
Verify It Workslogs / output / results
Good workflow: What repeats?When should it run?Schedule it carefullyVerify the task actually worked

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.

Examples: Run a backup every night Delete temp files weekly Generate a report every morning

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
Important habit:

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

* * * * * command-to-run

The five stars represent:

  • Minute
  • Hour
  • Day of month
  • Month
  • Day of week

Example: every day at 2:30 AM

30 2 * * * /home/user/backup.sh

This means: run the script at 2:30 every day.

Example: every hour

0 * * * * /home/user/check-health.sh

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

crontab -l

This shows the current user’s scheduled cron entries.

Edit scheduled jobs

crontab -e

This opens the current user’s crontab for editing.

Simple example entry

0 1 * * * /home/user/nightly-backup.sh

This would run the script every day at 1:00 AM.

Real-world habit:

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

0 0 * * * /home/user/run-report.sh

Every Sunday at 3:15 AM

15 3 * * 0 /home/user/weekly-cleanup.sh

Every 15 minutes

*/15 * * * * /home/user/check-status.sh

5) Fast Troubleshooting Pattern

  1. Confirm the command or script works manually
  2. Read the cron timing carefully
  3. Add the job with crontab -e
  4. List jobs with crontab -l to confirm it is saved
  5. Verify the job actually ran and produced the expected result
crontab -l crontab -e 30 2 * * * /home/user/backup.sh

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

crontab -e 0 1 * * * /home/user/nightly-backup.sh crontab -l

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

🔒 Locked until quiz ≥ 75% and you mark complete
Lesson 17 — Bash Scripting Basics

Tip: update the next lesson link when your page exists.

Leave a Comment