Cron

From XennisWiki
Jump to: navigation, search

The software utility Cron is a time-based job scheduler in Unix-like computer operating systems. People who set up and maintain software environments use cron to schedule jobs (commands or shell scripts) to run periodically at fixed times, dates, or intervals. (Wikipedia)

Installation

Arch Linux

pacman -S cron

For cron from cronie enable the service cronie.service.

Basics

List and edit cron table

List cron table

crontab -l

Edit cron table

crontab -e

Sample cron table

# Example configuration
#
# Format: Min H DoM Mon DoW

# Run myScript every Wednesday at 00:15 (with the date as parameter)
15 0 * * WED ./myScript.sh `date --rfc-3339='date' -d today`

# Run anotherScript on the 1st December at 00:15 
15 0 12 1 * scripts/anotherScript.sh

Mailto

MAILTO="cron@example.org"
<job here>

MAILTO="cron@example.org"
<another job here>

See also

  • at Schedule a command

External links