Welcome to the Slackware Documentation Project

This is an old revision of the document!

Task Scheduling in Linux


This article discusses some tools used in a Linux system to schedule tasks to run automatically at specified time intervals or at any given point of time in the future.

Some task-scheduling daemons used in Linux/UNIX are:

  • at – schedule one-time tasks for the future
  • cron – the periodic scheduler most commonly used
  • anacron – anachronistic cron; a periodic scheduler that doesn't rely on the system being left on 24×7

Using cron

cron is a daemon that runs tasks in the background at specific times. For example, if you want to automate downloads of patches on a specific day (Monday), date (2 July), or time (1300), cron will allow you to set this up in a variety of ways. The flexibility inherent in cron can allow administrators and power users to automate repetitive tasks, such as creating backups and system maintenance.

cron is usually configured using a crontab file. The following command will open your user account crontab file:

darkstar:~% crontab -e

To edit the system-level crontab, first log into the root account:

darkstar:~# crontab -e

If your system has sudo installed, type in:

darkstar:~% sudo crontab -e 

The crontab file syntax is:

minute(0-59) hour(0-23) day(1-31) month(1-12) weekday(0-6) command

Using an asterisk in any placeholder location, will match any value. For example, the following will run example_script.sh at noon (1200) everyday during the first three months of the year:

#For more information see the manual pages of crontab(5) and cron(8)
# min hr day month weekday command
0 11 * 1-3 * /home/user/example_script.sh
The links in red are to non-existent articles.

If you are experienced with those tools, please feel free to write the articles.


In Other Languages
Translations of this page?:
QR Code
QR Code howtos:general_admin:task_scheduling (generated for current page)