发布时间:2022-08-09 文章分类:编程知识 投稿人:王小丽 字号: 默认 | | 超大 打印

Contents

  1. Introduction
    1. Using Cron
    2. Crontab Sections
    3. Crontab Options
    4. Enable User Level Cron
    5. Further Considerations
    6. Troubleshooting and Common Problems
    7. Advanced Crontab
    8. GUI Applications
  2. Tips
    1. Crontab Example
    2. How Anacron is Arranged
    3. Cron Jobs Alternatives

Introduction

Cron is a system daemon used to execute desired tasks (in the background) at designated times.

A crontab is a simple text file with a list of commands meant to be run at specified times. It is edited with a command-line utility. These commands (and their run times) are then controlled by the cron daemon, which executes them in the system background. Each user has a crontab file which specifies the actions and times at which they should be executed, these jobs will run regardless of whether the user is actually logged into the system. There is also a root crontab for tasks requiring administrative privileges. This system crontab allows scheduling of systemwide tasks (such as log rotations and system database updates).

More information can be found:

 man crontab

or from the OpenGroup specifications.

An alternative in Gnome-based Ubuntu systems is to use the Gnome Scheduled tasks tool (from the gnome-schedule package) in Applications --> System Tools.

Using Cron

To use cron for tasks meant to run only for your user profile, add entries to your own user's crontab file. Start the crontab editor from a terminal window:

crontab -e