Linux timed Task cron configuration

Source: Internet
Author: User

Linux timed tasks are: cron, Anacron, at, and most of the cron tasks are used

noun explanation

cron--service name; a daemon that performs a periodic task or waits for some event to be processed under Crond--linux, similar to a scheduled task under Windows; crontab--is a custom scheduled task table

Package Installation

To use the Cron service, install the Vixie-cron package and the Crontabs package first, and the two packages function as follows:

The Vixie-cron package is the main program for Cron. The Crontabs package is a program used to install, uninstall, or list tables used to drive the cron daemon.

  To see if a cron package is installed: Rpm-qa|grep Vixie-cron

To see if the Crontabs package is installed: Rpm-qa|grep crontabs

If not, execute the following command to install the package (package must exist)
RPM-IVH vixie-cron-4.1-54.fc5*
RPM-IVH crontabs*

If you do not have a local installation package, you can install it online if you have a network connection

Yum Install Vixie-cron
Yum Install Crontabs

See if the Crond service is running

Pgrep Crond or/sbin/service crond status or ps-elf|grep crond|grep-v "grep"

crond Service Operations Command

/sbin/service Crond Start//Startup service
/sbin/service Crond stop//Shut down service
/sbin/service crond Restart//Restart service
/sbin/service Crond Reload//Reload Configuration

Configure Scheduled Tasks

Cron has two configuration files, one is a global profile (/etc/crontab), is for system tasks, and a set of configuration files generated by the crontab command (Files under/var/spool/cron), is for a user. Scheduled tasks can be configured to any one of them.

To view the global configuration profile configuration: Cat/etc/crontab

---------------------------------------------
Shell=/bin/bash
Path=/sbin:/bin:/usr/sbin:/usr/bin
Mailto=root
home=/

# Run-parts
* * * * * Root run-parts/etc/cron.hourly
4 * * * Root run-parts/etc/cron.daily
4 * * 0 root run-parts/etc/cron.weekly
4 1 * * Root run-parts/etc/cron.monthly
----------------------------------------------

To view scheduled tasks under a user: Crontab-l or cat/var/spool/cron/user name

crontab Task Configuration basic format

  

Linux timed Task cron configuration

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.