Cron is used to execute scheduled commands. It acts as a task scheduler on Linux and UNIX systems which will execute commands at specified times set by the user. Cron has a great deal of customization and is often used on server environments where common tasks are run on a regular basis.

Cron jobs can be set using the crontab -e command. On first run this will invite the user to select an editor for editing cron jobs.

From here, users can input their jobs, each command on a new line, with the desired timing preceding the command. The format for job timing can be used in a variety of ways, from specifying a command to run once a year, to once a minute, or only on Thursdays, etc. There are several examples on the Wikipedia page..

Upon saving the cron file, the crontab command will check the file for syntax errors, and if none are found, save it.

On Ubuntu there are more advanced cron options as well, such as root-level cron and the daily, weekly and monthly cron files. Read more about the specific options on the Cron How to Page.

Common uses of cron are scheduled updates, reboots, and backups. Cron can also be used to filesystem checks and other intense maintenance. Also see Advanced Crontab.

history | excerpt history