Running Programs at Specified Times

It is no wonder that the first digital computers were designed to handle repetitive tasks most people would find difficult or uninteresting. This is what computers excel at. This method of computing, known as batch computing, is still with us today, and the value of the digital computer, no matter what operating system, is cut severely if the computer system is solely dependent on an interactive mode, constant action and reaction from a user or users. This chapter explores some of the fundamental tools available on a Unix system for running programs at scheduled times—the first step in taking full advantage of digital computers.

Of course, you can't run anything at a scheduled time without a clock, so this chapter first explains how to set a system clock, how it relates to the clock embedded on the hardware, and how to synchronize the clock with other systems on a network.

This chapter also examines common tools such as crontab used to schedule and run programs and scripts on a Unix system, and provides working examples of how system automation can help save a user from unnecessary repetition and boredom.

System Clock

Most computer systems actually have two 24-hour clocks: a hardware clock and a system clock. The battery-powered hardware clock is embedded within the computer hardware. It's designed to keep track of time when the system is not turned on. The system clock is its software counterpart, created when the system initializes. It is ...

Get Beginning Unix now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.