Skip to main content


developerWorks  >  AIX and UNIX  >

Using cron to automate maintenance

The cron subsystem schedules tasks to run any hour of the day or night, making regular upkeep a breeze

developerWorks

Level: Intermediate

Martin Streicher (martin.streicher@gmail.com), Chief Technology Officer, McClatchy Interactive

07 Oct 2008

Register now or sign in using your IBM ID and password.

To leverage round-the-clock computing, tasks must run at all hours of the day. You could punctuate your sleep with waking interludes to log in and run this command or that command on dozens of machines, or you can enjoy your forty winks and turn the work over to the ubiquitous cron, a daemon, or perennial process, to execute commands on a schedule. From very often to every so often, cron happily minds the clock and runs jobs day or night. Learn how to configure and maintain cron, and discover just some of its many uses.

In this tutorial

Learn how to create, schedule, and manage cron jobs and how to define timetables to control job frequency, from once per minute to once per year. Additionally, learn how to limit access to cron to prevent abuse and how to use other utilities in tandem with cron to automate common maintenance tasks.


Prerequisites

This tutorial is written for users and systems administrators of UNIX® (and UNIX-like) systems. To follow this tutorial, you should have a general familiarity with a command-line shell and shell scripting. Some experience installing and configuring software on UNIX is also helpful.


System requirements

To run the examples in this tutorial, you need a UNIX computer. If you want to configure system-wide cron jobs, you also need root access. The examples shown in this tutorial are based on Vixie cron, which is used widely on modern UNIX systems, running on Ubuntu Desktop Linux® version 8.04.1. Other versions of cron are similar to Vixie; check the documentation for your UNIX system for specifics.


To view the demos included in this tutorial, JavaScript must be enabled in your browser and Macromedia Flash Player 6 or higher must be installed. You can download the latest Flash Player at http://www.macromedia.com/go/getflashplayer/.


Duration

1 hour


Formats

html, pdf


About this tutorial

This tutorial explains how to configure and maintain cron, the job scheduler found on almost all UNIX® machines. Additionally, this lesson demonstrates just some of the many applications of cron.

Share this....

digg Digg this story del.icio.us del.icio.us Slashdot Slashdot it!


Back to top


Document options

Document options requiring JavaScript are not displayed


My developerWorks needs you!

Connect to your technical community