$
Learn Linux handbook
en
XP:0
Quest 103Scheduler
+280 XP

Scheduling Tasks (crontab)

Launch Interactive Terminal for This Quest→No installation required • Runs fully in browser

Concept & Overview

Now that you have written robust shell scripts, you wouldn't want to log in at midnight just to run your backup helper. Linux provides the cron service to run commands or scripts automatically at specific times.

- The cron service checks a scheduling table called crontab.
- Each cron schedule has 5 fields representing time: minute hour day-of-month month day-of-week followed by the command.
- E.g., 30 2 * * * /path/to/script.sh runs a script every day at 2:30 AM.
- We use crontab -l to list our active cron jobs, and crontab to load schedules from a file.

Let's automate our backup helper. Write a cron scheduling string into a file named my_cron (for example, * * * * * /home/learner/backup_helper.sh to run every minute). Install this schedule by running crontab my_cron, and verify it by running crontab -l.

Command Syntax Reference

Command / SyntaxDescription
crontab my_cronInstall cron jobs from the file my_cron
crontab -lList active cron jobs for the current user

Verification Objectives

These conditions will be automatically verified when you run commands inside the interactive terminal simulator:

  • ○
    Create file "my_cron" in home with cron schedule
  • ○
    Install the cron schedule using crontab my_cron
  • ○
    List the active cron schedule with crontab -l

Ready to complete Quest 103?

Test your skills live in the browser terminal with an emulated Linux filesystem, real-time command evaluation, and instant step-by-step hints.