Job Scheduling - Part 2

Duration: 20 min

This video lesson is available to enrolled students.

Enroll to watch — ISRO Scientist/Engineer 'SC'

AI summary & chapters

AI Summary

An AI-generated summary of this video lecture.

This lecture segment, titled '3.2 Job Scheduling - Part 2', systematically covers advanced job scheduling mechanisms in Linux, progressing from the syntax of Cron expressions to one-time and load-based schedulers. The session begins by detailing the four special characters used in Cron expressions: the asterisk, comma, hyphen, and slash. The instructor uses a structured table to define each symbol's meaning and provides concrete examples, such as using a hyphen for a range of values (e.g., 9-17) or a slash for step intervals (e.g., */5). Following this, the lesson transitions to one-time job scheduling using the 'at', 'atq', and 'atrm' commands. A practical terminal demonstration shows how to schedule a backup job for 10:00 PM, list the queue with 'atq', and remove a job using 'atrm'. The lecture then introduces the 'batch' command, contrasting it with 'at' by explaining that batch is load-based rather than time-based. Finally, the instructor covers 'anacron', a scheduler designed for systems that are not running continuously. This includes an explanation of the 'anacrontab' configuration file and its basic format (period, delay, job-identifier, command). The segment concludes with a comparative table summarizing the basic differences between Cron, at, batch, and anacron.

Chapters

  1. 0:00 2:00 00:00-02:00

    The lecture introduces the 'Cron Special Characters' slide, which explains how symbols define and control schedules. A table is presented listing the Asterisk (every value), Comma (multiple values), Hyphen (range of values), and Slash (step/interval). The instructor highlights each row sequentially, underlining examples such as '0 9-17 * * *' for a range and '*/5 * * * *' for an interval.

  2. 2:00 5:00 02:00-05:00

    The lesson transitions to one-time job scheduling in Linux using the 'at', 'atq', and 'atrm' commands. A terminal demonstration shows a user scheduling a job with the command 'at 10:00 PM' followed by an echo statement. The instructor explains that the job is submitted using Ctrl+D (or <EOT>), and demonstrates how to view the queue with 'atq' and delete a specific job using 'atrm 7'.

  3. 5:00 10:00 05:00-10:00

    The instructor continues the breakdown of the 'at' command, using red hand-drawn circles and arrows to emphasize the syntax components: the time, the command to execute, and the submission signal. The segment then introduces the 'batch' command, defining it as a tool to schedule jobs when system load is low. A two-column table contrasts 'at' (time-based) with 'batch' (load-based), noting that both are used for one-time jobs.

  4. 10:00 15:00 10:00-15:00

    The focus shifts to 'anacron', described as a job scheduler for periodic jobs on systems that may not be running continuously. An example is provided where a daily backup job is executed only after the system starts if it was missed. Key features listed include its use for periodic jobs, day-based intervals, and the ability to catch up on missed executions when the system becomes available.

  5. 15:00 19:46 15:00-19:46

    The lecture details the 'anacrontab' configuration file located at '/etc/anacrontab'. The basic format is explained as period, delay, job-identifier, and command, illustrated by the example '1 5 daily-backup /home/user/backup.sh'. The segment concludes with a summary slide titled 'Cron vs at vs batch vs anacron', featuring a table that compares the four tools across their main purpose, scheduling basis, repetition capabilities, and best-suited use cases.

The lecture follows a logical progression from recurring to one-time and finally to conditional scheduling. It starts by reinforcing the syntax of Cron expressions, ensuring students understand how to manipulate time fields using special characters. It then moves to the 'at' family of commands, providing a clear workflow for creating, monitoring, and deleting one-time tasks. The introduction of 'batch' serves as a direct contrast to 'at', highlighting the difference between time-based and load-based triggers. Finally, 'anacron' is presented as a solution for the common problem of missed schedules on non-continuous systems. The final comparative table serves as a consolidation tool, helping students distinguish which scheduler is appropriate for specific administrative tasks based on their frequency and system availability.

Loading lesson…