Basic commands in Linux: task plan setting commands at, batch, and cron

Source: Internet
Author: User

(1) point: execute a task at a certain time point in the future, and use two commands to implement at and batch

Enter the at time in the command prompt. Enter the task to be executed at that moment and support multiple tasks. after entering the first task, press enter to enter the second task, ctrl + d to submit the scheduled task

Time specifying method:

Absolute Time: HH: MM, DD. MM. YY, MM/DD/YY

Relative time: now + # Unit

Unit: minutes, hours, days, weeks

Fuzzy time: noon, midnight, teatime

The execution result of the At task is sent to the user who arranges the task by email.

Fg: Execute ls/etc/and cat/etc/fstab in three minutes.

View at job LIST command: at-l

Delete a job: ad-d job number.

At configuration file/etc/at. deny and/etc/at. allow

If deny exists independently, deny assumes that all users can use the at command.

If allow exists independently, only users in allow can use the at command.

If both exist, only users in allow can use the at command.

Batch: you do not need to specify the time to automatically execute the specified task when the system is idle. Other usage is similar to.

(2) Periodically execute a task

1. Cron: it is an uninterrupted service. However, sometimes shutdown or service interruption is caused by external factors, and the execution of the unexecuted task will not be executed in the past.

Anacron: cron supplements allow cron to resume normal execution of unexecuted tasks due to various reasons in the past.

2. Cron tasks are classified into system tasks and user tasks.

System cron task

Definition file/etc/crontab

Format: minute hour day month week user task

User cron task

Definition file/var/spool/cron/USERNAME

Format: minute hour day month week task

  • 1
  • 2
  • 3
  • Next Page

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.