sections in this module City College of San Francisco - CS260A
Unix/Linux System Administration

Module: Periodic Processes
module list

run-parts

Current linux systems use a simple scheme to ease the addition of cron jobs with a periodicity of an hour, a day, a week, or a month, while placing them (except the hourly job) under simultaneous control of cron and anacron. It relies on the command run-parts.

run-parts is a shell script that takes a directory argument. It simply runs each executable file in that directory, skipping those with extensions used by certain programs for installations and backups. (see the run-parts script)

The master anacrontab on linux includes three commands that use run-parts. (Remember, cron now runs jobs that are in anacrontab!) One command each is used to run daily, weekly and monthly jobs, giving run-parts a directory containing the appropriate set of tasks. (Thus, one command in anacrontab (with a period of 1 day) is used to run daily tasks, giving run-parts the /etc/cron.daily directory ...) In addition, a separate cron job (in the master cron directory /etc/cron.d) uses run-parts to run jobs that must be run hourly. (This last job cannot be in the anacrontab, as anacron only has a granularity of days.)

This automated use of a directory to hold these jobs to be run at regular intervals (hourly, daily, weekly or monthly) makes it easy to add such a job to the system. To add a job that must be executed daily, for example:

Investigation of this helpful scheme is left to the reader. You should look at the run-parts command, at the master crontab and anacrontab, at the directories used with the run-parts commands and list (with attributes) the directory containing anacron time stamps.

Preview question: cron can also be used to execute a task once, but this is really the purview of at. Check out the man page for at. Is it a subsystem?

Prev This page was made entirely with free software on linux:  
Kompozer
and Openoffice.org      
Next

Copyright 2011 Greg Boyd - All Rights Reserved.
Document
                    made with Nvu